开发者

Javascript: Determine if URL in PopUp changes/is redirected

开发者 https://www.devze.com 2023-02-20 09:53 出处:网络
I want do open a popup, and determine, if the URL changes(e.g. after 5 seconds) through META/301-header/JavaScript-redirect/etc. ->

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

精彩评论

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