Asanka
Asanka

Reputation: 559

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 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.

Upvotes: 0

Views: 593

Answers (1)

Chinmayee G
Chinmayee G

Reputation: 8117

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

Upvotes: 0

Related Questions