0

I use popups for private chat in my site. I can't use a dialog for some reason. Any way to stop popup blockers from blocking my popups?

I think this code is useful but I don't know how use it.

document.popup = false;
function setCookie(name, value)
{
document.cookie = escape(name) + "=" + escape(value) + "; path=/";
}
function getCookie(name)
{
var exp = new RegExp(escape(name) + "=([^;]+)");
if (exp.test(document.cookie + ";"))
{
exp.exec(document.cookie + ";");
return unescape(RegExp.$1);
}
else return false;
}
document.popup = getCookie('popup');
function openPopup()
{
if (document.popup) return;
window.open('http://mikhakshop.melimarket.com','SHOP','toolbar=no,statusbar=no,location=no,scrollbars=yes,resizable=yes,width=1024,height=600');
document.popup = true;
setCookie('popup', 'true');}
document. = openPopup;
if ((window.XMLHttpRequest == undefined) && (ActiveXObject != undefined)) window. = openPopup;
JJJ
  • 32,902
  • 20
  • 89
  • 102
behzad n
  • 239
  • 3
  • 5
  • 15
  • 4
    There is a reason popup blockers exist. Trying to subvert seems like a bad idea (seems kinda shady). Instead, I would just put up a message telling your visitors that the site uses popups and to allow them through their blockers. – Travesty3 May 22 '12 at 13:00
  • Popup blockers block any window.open calls that were not invoked by user. if you can somehow redesign it to be invoked by user, you'll solve the problem. – eric.itzhak May 22 '12 at 13:07

1 Answers1

0

No, you can not bypass pop up blockers.

Their behavior is to block any window.open calls that were Not Invoked By User, or that runs in a timeout. However, i guess it's possible somehow because some websites open a pop up commercial, but i noticed all of them are being opened in the background without focus, so this won't be helpfull to your problem.

You can consider and redsign your chat so that user has to click a button, but that dosen't seem to be something you want to do.

What you should be asking yourself, is why the Dialog isn't working?

eric.itzhak
  • 15,752
  • 26
  • 89
  • 142