Tuesday, June 4, 2024
 Popular · Latest · Hot · Upcoming
126
rated 0 times [  133] [ 7]  / answers: 1 / hits: 16583  / 7 Years ago, mon, july 3, 2017, 12:00:00

I have seen this question being asked many times here, but I couldn't get an answer that works!



i am trying to redirect to a load.php TO A NEW TAB using the following script:



echo '<script>window.open(load.php,_blank)</script>';


for some reason it is not working and it stays on the same page.




i am using chrome!




is there any possible way to redirect to a new tab?
thanks a lot


More From » php

 Answers
1

Most browsers will block window.open unless it is a result of a direct user interaction i.e. the onclick event handle of an anchor tag being fired.



There are ways you can try and trick popup blockers, but it is unreliable and considered bad practice. If a user has chosen to enable a popup blocker, it should be respected.



What I would suggest is to also add a link on your page along the lines of the following:



<a href=load.php target=_blank>Click here</a> if the window does not open in a seperate window.


This would ensure that the user can still open the window manually should it be supressed by a popup blocker.


[#57220] Friday, June 30, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
iliana

Total Points: 246
Total Questions: 109
Total Answers: 82

Location: Palestine
Member since Tue, Jul 20, 2021
3 Years ago
iliana questions
;