I know that this problem is in many question but I haven't found a solution to my problem.
This is the original code top open a popup:
<script type="text/javascript">
window.open("link.php", "_blank");
</script>
The code works fine in all browser except Safari. To solve this I have create this code:
<script type="text/javascript">
var open = window.open("link.php", "_blank");
if (open == null || typeof(open)=='undefined')
alert("Turn off your pop-up blocker!");
</script>
Now this code in firefox return me this error:
TypeError: window.open is not a function
var open = window.open("link.php", "_blank");
How can I solve this problem?
Change your code a little bit like this
<script type="text/javascript">
var _open = window.open("link.php", "_blank");
if (_open == null || typeof(_open)=='undefined')
alert("Turn off your pop-up blocker!");
else
</script>
This should work now. The problem was that you're overwriting the window.open function using the global variable open
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.