Is there any way to pop up new window on swipe event, like on click?
Browser's bockers for some browsers blocking it. So far I tried to trigger click event on swipe, tried to delay pop up, tried to use e.preventDefault(), tried to window.document.write(htmlcontent), so far nothing really helped.
CodePudding user response:
Check out this thread.
it implies that the following code might work:
div {
height: 100px;
width: 100px;
background-color: powderblue;
}
<div ontouchmove='window.open ("https://stackoverflow.com/", "myWindow", "height=418, width=455, left=500, top=250, toolbar=0, titlebar=0, menubar=0, scrollbars=no, resizable=no, location=no, status=no");'> swipe</div>
CodePudding user response:
Couldn't edit the original questions, though here is a code snipped for you: no pop-up blocking apeared, though even if you aprove pop-up the browser ignores.
document.addEventListener('touchmove',e => {
window.open("https://stackoverflow.com/questions/71914104/pop-up-on-swipe")
})
Note: Touch Devices only edit:
Check out this thread.
it implies that the following code might work:
div {
height: 100px;
width: 100px;
background-color: powderblue;
}
<div ontouchmove='window.open ("https://stackoverflow.com/", "myWindow", "height=418, width=455, left=500, top=250, toolbar=0, titlebar=0, menubar=0, scrollbars=no, resizable=no, location=no, status=no");'> swipe</div>