How can I pass attribute value from iframe to parent?
I.e. iframe (frame1) has <a id="a1" href="http://www.infinitybusiness.net">
. How can I get value of href
in my parent page?
How can I pass attribute value from iframe to parent?
I.e. iframe (frame1) has <a id="a1" href="http://www.infinitybusiness.net">
. How can I get value of href
in my parent page?
This is a great tutorial that talks exactly about that: http://www.roseindia.net/java/pass-value-example/pass-value-from-iframe-parent.shtml
you can use it only if the two pages are served from the same domain. There are many solution for cross-domain scripting as well..you can read more here: http://softwareas.com/cross-domain-communication-with-iframes
var fra = document.getElementById('frameId');
// following will work on same domain (or subdomain with document.domain set) only
var fraContent = fra.contentDocument || fra.contentWindow.document;
myLinkHref = fraContent.getElementById('myLinkId').href;
If this is cross-domain, then you will need to have access to add script to the child frame. If not, it can't be done without a server-side proxy.