Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iframe.contentWindow.document Chrome alternative?

How would I call the following in Chrome? iframe.contentWindow.document

like image 507
Skizit Avatar asked Feb 15 '11 16:02

Skizit


1 Answers

Chrome does in fact support iframe.contentWindow.document, but there's a little wrinkle that you've probably fallen prey to: if the file set to the iframe.src property is being accessed locally (i.e. using the "file://" protocol), that property is inaccessible in Chrome. This will happen if you specify a relative file address and attempt to test the script without using a web-server like IIS or Apache (by simply double-clicking it). The same also applies to iframe.contentDocument.

I ran into a similar problem where, for some odd reason, Chrome would not accept event handlers dynamically attached to iframes. Then I found the note in this article, tested with Apache, and hey presto, it suddenly began to work.

like image 150
Jurij Belous Avatar answered Oct 25 '22 16:10

Jurij Belous