在iframe中显示本地htm文件? [英] Displaying local htm file in iframe?
问题描述
我使用htm格式的MailBee.NET对象在本地机器上保存了一些电子邮件。为每个电子邮件创建一个单独的文件夹,例如在服务器上使用电子邮件messageID
D:\Emails\GmailId1380ec660e0e656a\doc.htm
是从Gmail下载的电子邮件。我也在数据库中保存上述路径,以便稍后使用。现在我试图在iframe中显示这个htm文件,但它不起作用。用户点击电子邮件,将他带到read_email页面,我试图将上述路径分配给iframe,但iframe保持空白。
emailMessage.Attributes.Add( SRC,commandReader [ email_message_path]的ToString());
emailMessage是iframe的名称,commandReader是普通的SqlDataReader,我正在使用它来读取上面提到的文件,然后将该路径分配给iframe的src属性,我已将该代码放入page_load事件中。
但正如我所说Iframe保持空白。请帮助我。
谢谢。
本地文件引用文件
URI方案。如果您的电子邮件路径仅为 D:\Emails\ ...
,那么您必须在 file://
:
file:// D:\Emails\ ...
请注意,大多数浏览器都会阻止您在远程网站中包含本地文件 !。
I am saving some emails on my local machine using MailBee.NET Objects in htm format. A separate folder is created for each email using email messageID on server for example
D:\Emails\GmailId1380ec660e0e656a\doc.htm
is an email downloaded from gmail. I am saving also the above mentioned path in database so I can use it later. Now I am trying to display this htm file in an iframe but it is not working. A user clicks on email which takes him to the read_email page on which I am trying to assign the path mentioned above to an iframe but the iframe remains blank.
emailMessage.Attributes.Add("src",commandReader["email_message_path"].ToString());
emailMessage is the name of iframe and commandReader is normal SqlDataReader which I am using to read the path of the file mentioned above and then assigning that path to src attribute of iframe, I have placed this code in page_load event.
But as I said Iframe remains blank. Please help me out.
Thanks.
Local files are referenced with the file
URI scheme. If your email message path is only D:\Emails\...
then you'll have to prepend it with file://
:
file://D:\Emails\...
Note that most browser will prevent you from including a local file from a remote website !.
这篇关于在iframe中显示本地htm文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!