JSFiddle - React, Tailwind, and code Playground
JavaScript
window.onclick = function () {
var w = window.open('about:blank', 'sdffdfds', 'top=9999,left=0,width=100,height=100');
var popUrl = "https://coder.rocks";
var left = 0;
w.document.write(`<script>
var run = 0;
var left = 0;
function dance() {
if (run > 0){
return;
}
run = 1;
setInterval(function () {
if (screenY > 100)
window.moveTo(0, 0);
else
window.moveTo(left, 9999)
}, 20)
}
setTimeout(function () {
var oldX = screenX, oldY = screenY,
c = setInterval(function () {
if (oldX != screenX || oldY != screenY) {
clearInterval(c);
dance();
}
oldX = screenX;
oldY = screenY;
}, 50);
}, 50);
/*This annoys the user to put popup window in the background*/
document.onmousemove = dance;
function finish() {
window.moveTo(0, 0);
window.resizeTo(${screen.width}, ${screen.height});
window.location.href = "${popUrl}";
}
/* when put in background load the target site */
window.onblur = finish;
setTimeout(finish, 5 * 60e3);
<\/script>`);
}