开发者

Accessing Document elements retrieved by window.open method

I want to pop up a new browser according to the url provided, for which I am using javascript's window.open function. But, what I really want is to examine the new window popped 开发者_JAVA百科up and change the url of it and redirect to a different site. This is how I tried to do it,

<script type="text/javascript" language="javascript">
        var win;
        function openWindow(winURL){
            win = window.open(winURL,null,'');
            if(win.document.getElementById('username')!=null)
            {
                //redirect to a new page
            }            
        }
</script>

But when I access the document element, it pops up an error saying "Access is denied" How can I achieve my requirement?

Any help is highly appreciable.


This seems to be cross domain issue. You're probably opening url with other domain. thats why it is giving access denied error.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜