Skip to content Skip to sidebar Skip to footer

How Can I Create A Function In Another Frame?

I have a 3rd party generated frameset (from a help system) and I can add code to the subframe that has my content pages. I cannot modify the other frameset content since it is gene

Solution 1:

There is 1 condition for cross-frame javascript: All involved pages (in different frames) need to be on the same domain. If pages are on different domains or subdomains - cross-frame javascript access will be restricted for security purposes.

Lets suppose you have a frameset with 2 pages: index.html and index2.html

If these pages are on the same domain - they will share the same javascript namespace, i.e. all javascript libraries linked to index.html will be accessible from index2.html and versa versa.

If pages are located on different subdomains of the same domain - it is possible to step several levels up. For example:

frame1 contains:    http://myrepo.site.com/index.html
frame2 contains:    http://another.site.com/index2.html

you can set for both (in JavaScript): document.domain = "site.com" After that - javascript code on both pages will start seing each other, same as these pages are on the same domain.

Post a Comment for "How Can I Create A Function In Another Frame?"