简体   繁体   English

打开新的Web浏览器选项卡,然后重复使用相同的选项卡

[英]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. 基本上,我试图自动打开一个新的Web浏览器选项卡,这是我第一次可以这样做。 -This can be done using javascript: window.open -这可以使用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. 应该打开第一个新标签页: http : //www.jango.com/music/KATY+PERRY/Dark+Horse/video? l = 0-警告它在加载时播放视频。

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. 然后我想打开: http : //www.jango.com/music/KATY+PERRY/I+kissed+a+girl/video? l =0,但替换了最后一个选项卡:不使用新选项卡。

Since I do not own jango.com I am majorly constrained. 由于我不拥有jango.com,因此我受到了很大的限制。

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,然后解决您不拥有站点的问题

 <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 然后使用与上面相同的语法再次更改src,但是使用settimeout用法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM