开发者

Javascript: Determine if URL in PopUp changes/is redirected

I want do open a popup, and determine, if the URL changes(e.g. after 5 seconds) through META/301-header/JavaScript-redirect/etc. -> FF gives me a permission-error, since I can NOT read the url of the popup, guess it has something to do with the cross-domain policy?!!?

<script>

  var redurl = 'http://www.goog开发者_开发知识库le.com/';

  cr = window.open(redurl, 'cr', "left=0,top=0,width='50',height='50',scrollbars='no'");

  window.setTimeout(
  function ()
  {
    try
    {
      if(cr.location.href !== redurl) alert('redirect');
    }
    catch (e)
    {
      alert('(permission error?!?!?)');
    }

    cr.close();
  }, 5000);

</script>


Yes, you can't access the URL of a frame displaying a document from another domain due to cross-domain policy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜