Skip to content

Instantly share code, notes, and snippets.

@nokimaro
Created September 15, 2016 03:05
Show Gist options
  • Select an option

  • Save nokimaro/eb6972f1aca2dbfa57d7ac3c5950d3bc to your computer and use it in GitHub Desktop.

Select an option

Save nokimaro/eb6972f1aca2dbfa57d7ac3c5950d3bc to your computer and use it in GitHub Desktop.
var _parent = self,
bSimple = false,
popunder;
if (top != self) {
try {
if (top.document.location.toString()) {
_parent = top;
}
}
catch(err) { }
}
popunder = _parent.window.open(url, '_pu123123123', window_params);
if (popunder) {
popunder.blur();
if (bSimple) {
/* classic popunder, used for ie*/
window.focus();
try { opener.window.focus(); }
catch (err) { }
}
else {
/* popunder for e.g. ff4+, chrome */
popunder.init = function(e) {
with (e) {
(function() {
// if (typeof window.mozPaintCount != 'undefined' || typeof navigator.webkitGetUserMedia === "function") {
//var x = window.open('about:blank');
//x.close();
// }
try { opener.window.focus(); }
catch (err) { }
})();
}
};
popunder.params = {
url: url
};
popunder.init(popunder);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment