Can't display an iframe of a "file" protocol url src when the html is load with http

http, iframe, localhost

Solution

Most modern browsers disallow framing of `file:` URLs from non-`file:` URLs to avoid security issues. For example, back when this was allowed there were nefarious websites that would open up a frame with a directory from the user's file system in an attempt to scare the user into thinking they had been "hacked". Some of the site that would do this would then try to sell the user "protection" software (which probably turned out to be malware itself).

So anyway, you can't reliably expect to frame `file:` URLs on modern browsers.

Problem

I was trying to add an iframe on a html page and I realized that when I load my HTML file via the HTTP protocol (at the adress : localhost/file.html for example), only files with their `"http://localhost.."` URL are displayed in the iframe. Website urls or local files (accessed with `"file:///C:/..."`) return nothing in the iframe (not even "Not Found" or another error). As well, when I open my file with the `file` protocol (then the url is `file:///C:/UwAmp/www/file.html`), website's urls still don't work in the iframes (but locals files loaded with `file` or `http` aren't a problem). Why links with "file:///" are ignored in pages loaded with the HTTP(S) protocol ? And why I can't display websites in none of my iframes ? Thank for any help. (Sorry for my english, I tryed my best to explain).

Original source