I try to display html file inside an iframe.
The html file is located inside a local folder on my server, with the relevant permissions (for example: c:\temp).
I tried:
iframe = document.createElement("iframe");
iframe.src = "file:///c:\temp\a.html";
iframe.style.display = "block";
document.body.appendChild(iframe);
But the content is not displayed inside the iframe.
another solution I tried is to use ajax to display the html inside a div:
$("#DIV").html( *READ HTML TEXT FROM FILE *)
But the problem here is that I have pictures and css file included inside the html page, and they can’t be displayed because the current location is my web site (they are included in c:\temp folder with the html).
Does anyone have an idea how can I display html page with images inside an iframe?
The problem is that the browser sees that
file:///c:\temp\a.htmlas a file local to the browser, so it points to the C: drive of the visitor.You can set up that local folder to be a Virtual Directory of your website (in IIS) and refer to the file using the correct web-path (http://…). That way you don’t move the folder but it is still available through the webserver.