File: /// to http: // communication via IFrame

Perhaps some of you may have faced the same problem as me. Imagine that you have a file on your computer: file: /// c: \ test.html

And you have an IFrame inside this file. You need to indicate whether the contents of the IFrame are loaded or not.

It’s bass that we have here: 1. location, href or any other property is not accessible from the file: /// to http: /// or back. 2. You cannot fire an event from a browser window in an iframe or in the opposite direction, unfortunately.

Does this problem have a solution? PS: This is not a hack. this is a real problem. interaction with the local machine with site integration.

UPD: I understand why this is prohibited. Any interaction with local files should be prohibited from the web page. This is great, I agree. But isn't a hashtag something that can harm anyone ?: (

+4
source share
1 answer

You may find some of these methods useful: http://softwareas.com/cross-domain-communication-with-iframes

Change In the comments below, these methods do not work when accessing file:///c:\<path>\test.html , whereas when accessing http://localhost/test.html .

I think because the file protocol is even more limited by the browser than the http protocol. The MSDN page in the file protocol reports:

Internet Explorer 6 Service Pack 1 (SP1) no longer allows you to view the local machine from the Internet zone. For example, if a website contains a link to a local file, Internet Explorer 6 SP1 displays a blank page when a user clicks on the link. Previous versions of Windows Internet Explorer followed a link to a local file.

No matter which method you used to obtain cross-domain communication, it was probably blocked by the browser because you used the file protocol.

+2
source

All Articles