I want to open a new tab instead of a popup window

泄露秘密 提交于 2019-11-29 10:43:39
fray88

In case it could be a javascript issue about override functions, do that:

<script>
(function(window, undefined){
    var win = window.open('your_url', '_blank');
    win.focus();
})(window);
</script>

That should make you can't use functions from other javascript code out of your function(window, undefined) wrapper-

You can do it by window.open(url, '_blank');

assign the url to open to a tag's href attribute, with target="_blank", then trigger link click when you want. Example:

<a id="myLink" href="hello.php?username=<?php echo $username; ?>" target="_blank">

Then, call a js function to trigger link click

document.getElementById('myLink').click();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!