Ilan Kleiman
Ilan Kleiman

Reputation: 1209

Reloaded page to have added content

On my page I have the following code:

<script type="text/javascript">
            if(!window.opener) {
                window.open(window.location.href, '_blank');
            }
        </script>

Basically opens 'itself' in a new window, without a constant loop.
How can I add 'additional' Javascript content to the new window it opens up, and not the original?

Upvotes: 0

Views: 25

Answers (1)

kol
kol

Reputation: 28718

<script type="text/javascript">
    if(!window.opener) {
        window.open(window.location.href, '_blank');
    } else {
        // ...add additional content here...
    }
</script>

Upvotes: 2

Related Questions