Reputation: 509
In Jquery/Javascript Is there a way to detect if the browser (chrome in my case) is blocking popups when my web loads? If that is not possible, then an alert before my window.open command will be satisfying as well.
I know this question already been asked before, but the questions are pretty out dated and I can't find a solution.
Thanks.
Upvotes: 1
Views: 1302
Reputation: 29
You could try to open an invisible popup which is updating the php session variable to "true" if it is opened and if not, leaves it to "false", for example:
Once the user opens your site: session_start() and set session variable "$_SESSION["popupEnabled"]" to FALSE. After the site has been sent to the users browser execute a JS script which loads an AJAX request to another PHP script with just 2 lines of code: session_start(); and "$_SESSION["popupEnabled"]" to TRUE.
Now you can check systemwide:
If($_SESSION["popupEnabled"] == FALSE)
{
echo 'popups NOT allowed';
}
else
{
echo 'popups allowed';
}
Upvotes: 1