Thursday, October 13, 2011

javascript: iframe cross site script

given a parent page with an iframe-contained child page... from the child page, you can readily call a javascript function on the parent page IF both parent and child pages are on the same server.

now, WHAT IF your iframe-contained child page is a page residing on another server?

here's what you can do:
1. know the domain your parent frame holder is using (ex. www.xxx.ph)
2. point a subdomain to the server hosting your child page (ex. child.xxx.ph)
3. set domain in javascript for both parent and child page
 <script>document.domain="xxx.ph"</script>

now you can call your javascript function in your parent page from the iframe-contained child residing on another server!

;)

check out http://www.cybersoft.ph/testIFrame/iframeParent.html

No comments:

Post a Comment

SSH : No matching host key type found. Their offer: ssh-rsa,ssh-dss

Got this while connecting to my mikrotik router via ssh   Unable to negotiate with <ip address> port <ssh port>: no matching hos...