Julii Giambelluca
Julii Giambelluca

Reputation: 13

Open new web browser tab, and reuse the same tab

Basically, I'm trying to open a new web browser tab automatically Which i can do the first time. -This can be done using javascript: window.open

This new tab will play music.

I then want to open another music playing site, not in a new tab because then it'll play two songs at once, but replacing the tab i opened earlier:

First new tab should open: http://www.jango.com/music/KATY+PERRY/Dark+Horse/video?l=0 --warning it plays a video when it loads.

And then i'd like to open : http://www.jango.com/music/KATY+PERRY/I+kissed+a+girl/video?l=0 but replacing the last tab: NOT using a new one.

Since I do not own jango.com I am majorly constrained.

Upvotes: 1

Views: 1621

Answers (1)

Mudassir
Mudassir

Reputation: 1156

Why don't you change the window the user was originally on and open a new tab for the other window.

 window.open(url,'_blank');  //opens window in new tab
 window.open(url);  //redirects current page to new url

The new tab can be set on a timer so when user is finished with first content it actomatically opens a new tab.

Please comment back if you need more help or this solution is not the one you are looking for.

OR YOU CAN USE AN IFRAME THEN YOUR PROBLEM OF NOT OWNING THE SITES WILL BE SOLVED

 <iframe src=""></iframe> <!--use javascript to change url when needed-->


 EXAMPLE:
 <iframe id="myFrame" src="/default.asp">
 <p>Your browser does not support iframe in html5</p>
 </iframe>

 <p>Click the button to change the value of the src attribute in the iframe.</p>

 <button onclick="myFunction()">Try it</button>

 <script>
 function myFunction()
 {
 document.getElementById("myFrame").src="http://www.jango.com/music/KATY+PERRY/Dark+Horse/video?l=0";
 }
 </script>

Then change the src again using the same syntax above however using a settimeout useage

Upvotes: 1

Related Questions