window.open returns null and fails in inline script but works from console

前端 未结 2 1757
刺人心
刺人心 2020-12-07 00:23

I\'m using Smarty template system. One of its features is posibility to output script that generates debug information for every page. Here you can see an example of generat

2条回答
  •  时光取名叫无心
    2020-12-07 01:26

    Try the next command after window.open with timeout, for example:

    var myWindow = window.open('foo','_blank','menubar=no, scrollbars=yes, top=10, width=800,height=600');
    
    setTimeout( myWindow.onload=function(){this.document.body.innerHTML+='bar';}, 2000 );
    

提交回复
热议问题