I want to get click item from popup window. example when i run below code and click google here show a popup window and here show two button 1.Google search 2.I am feeling Lucky.
now i want to get that a user whois button was click ?
` <html><head></head><script>function popitup(link) { var w = window.open(link.href,
link.target||"_blank",
'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,dependent,width=800,height=620,left=0,top=0'); return w?false:true; // allow the link to work if popup is blocked }</script><body><a href="http://www.google.com" onclick="return popitup(this)">Google</a></body></html> `
I think it will depend on the opened pages same-origin policy
The returned Window reference can be used to access properties and methods of the new window as long as it complies with Same-origin policy security requirements.
.
I can not access the properties of the new secondary window. I always get an error in the javascript console saying "Error: uncaught exception: Permission denied to get property <property_name or method_name>. Why is that?
It is because of the cross-domain script security restriction (also referred as the “Same Origin Policy”). A script loaded in a window (or frame) from a distinct origin (domain name) cannot get nor set properties of another window (or frame) or the properties of any of its HTML objects coming from another distinct origin (domain name). Therefore, before executing a script targeting a secondary window, the browser in the main window will verify that the secondary window has the same domain name.
Dear supose i create popup window from first.html by open.window(“youtube.com/chanel/userchanel”); after opening the
popup window here show chanel subscribe button. now i want to know that user click subscribe button from first.html page. so plz help me
What is the cross-origin policy of the youtube.com domain?
As has been posted, if not clearly enough, is that unless a domain explicitly allows JavaScript on a different domain to interact with it. It can not be done
The JavaScript code from your domain can interact with HTML that is on your domain. You can include content from other domains, but that content is “sandboxed” for security reasons.