<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d8211560\x26blogName\x3dTech+Tips,+Tricks+%26+Trivia\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://mvark.blogspot.com/search\x26blogLocale\x3den\x26v\x3d2\x26homepageUrl\x3dhttp://mvark.blogspot.com/\x26vt\x3d601588505461698440', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Tech Tips, Tricks & Trivia

by 'Anil' Radhakrishna
An architect's notes, experiments, discoveries and annotated bookmarks.

Search from over a hundred HOW TO articles, Tips and Tricks

Bane of pop-ups and pop-up blockers

Don't we all hate pop-up windows pop-ups that try to sell us everything from discounted airline tickets to unmentionable-s. There are myriad pop-up blockers now to counter these popping monsters. In fact all browsers now come with in-built blockers. The trouble with these however is that when as a developer you have some genuine functionality to show in a cute child window instead of the parent window itself, it gets blocked too! And the user may be unaware of this....

The javascript below does not prevent a genuine window from being blocked but gives a prominent alert to the user about the blockage.

function blocker()
mywin = window.open('show.html',"","left=100,top=50,
height=600, width=700, statusbar=no");
if (!mywin) alert("A window was blocked. Please disable
your blocker or whitelist this website");

<BODY onload=blocker()>


Tweet this | Google+ it | Share on FB

« Home | Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »
| Next »


Post a Comment