2017-10-07 142 views
0

我创建标记<a href="http://s02.radio-tochka.com:4870/radio" class="player-link" target="_blank">Button</a>和添加事件监听器后`var button = document.querySelector('。player-link');Firefox打开window.open不工作

button.addEventListener('click', function (event) { 
     event.preventDefault(); 

     window.open(
      event.target.href, 
      "mywin", 
      "width=340, height=280, status=0, menubar=0, location=0, resizable=0, directories=0, toolbar=0, scrollbar=1" 
     ) 
    }) 

, but Firefox open new window and in address bar just about:blank`。什么可能是一个问题?

回答

0

发现在文档:

远程URL不会立刻加载。当window.open()返回时,窗口始终包含about:blank。 URL的实际获取被延迟,并在当前脚本块完成执行后开始。创建窗口和引用资源的加载是异步完成的。

+0

好的,谢谢你的评论!但我怎么能解决这个问题? –

+0

很可能你的脚本没有完成执行 – taha