JS Chrome top.document

What is the Chrome equivalent of "top.document", valid in both FF and IE8.

In Chrome, "top" really, top.length returns 2 (frames) ... as it should. But top.document returns 'undefined'. Need to get the item. top.document.getElementById (id) works fine in both FF and IE8.

Thanks in advance, SWK

+3
source share
2 answers

I know my answer late, but it drove me crazy, and the problem seems to me, in any case, simply because my page was not actually posted. It was just a prototype lying in a network folder. If the page is hosted on a server, it works fine.

, , Chrome , . , .

, , try/catch, Javascript . , , .

+1

if (top.document == 'undefined')
{
   top.document = window.top.document || null;
}

, Chrome top.document , , !

0

Source: https://habr.com/ru/post/1747711/


All Articles