Jquery: how to check if a newly opened window has been fully loaded? / window loads an external page (like www.yahoo.com)

后端 未结 3 1630
孤街浪徒
孤街浪徒 2020-12-20 18:05

the following doesn\'t work , why ?

var myWindow=null;
myWindow = window.open(targetUrlVar,\"_blank\",\"resizable=yes\");
$(myWindow).load(function(){
    a         


        
3条回答
  •  清酒与你
    2020-12-20 18:37

    I see this question is somewhat old.

    However, arthur stated,

    for targetUrlVar being an internal resource (like a page belonging to my domain) it works.. but as soon as i wanted to used the .load() or myWindow.onload() with a targetUrlVar being an external page (such as www.yahoo.com or www.google.com ), it doesn't work any more... No alert is displayed..

    I think that the issue may be due to the targetUrlVar being external; the alert may be blocked to prevent cross-site scripting (aka XSS).

提交回复
热议问题