如何使用新URL替换javascript弹出窗口中的旧URL

时间:2022-09-20 10:28:05

I need help of getting this piece of code to work

我需要帮助才能使这段代码工作

1) I want to automatically start a media player when a pop-up is open, by changing is URL params, that the pop-up has

1)我想在弹出窗口打开时自动启动媒体播放器,通过改变URL params,弹出窗口有弹出窗口

2) When the user clicks on on the link I want to replace the old URL with the one the new one clicked. Try using location.replace just ends up being a constant loop.

2)当用户点击链接时,我想用旧的URL替换新的URL。尝试使用location.replace最终成为一个常量循环。

Not having much luck with the code can anyone help????

没有太多的运气与代码可以任何人帮助????

 var vidlink = $('.link').attr('href');
 var autoplay = $('.link:first').attr('href'); 

  var myurl = window.location.href,
  paramsStr = autoplay,
  paramsObj = {};   
  var newUrl = $.param.querystring(myurl, paramsStr );

  if(window.location.href != newUrl){
    location.replace(newUrl);
 }  

 $('.link').click(function(){
        loadPlayer(vidlink);
      }); 

<a href="javascript:openplayer('http://localhost/player.php?v=0&a=false');">Open Player</a>

player another show <a href='?v=53&a=false' class='link'>Ep2</a>

1 个解决方案

#1


0  

try windowname.document.location = newURL (where windoname is the name of the pop-up)

尝试windowname.document.location = newURL(其中windoname是弹出窗口的名称)

#1


0  

try windowname.document.location = newURL (where windoname is the name of the pop-up)

尝试windowname.document.location = newURL(其中windoname是弹出窗口的名称)