I am trying to open a new tab.
But Window.open()
is opening up popup window.
I want to open hello.php
file in a new tab.
But it is opening
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();
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');