Reputation: 3
I am not much experience much in javascript. Recently i am trying to learn and implement popunder onclick. Its working perfectly for me but unfortunately every time open a popunder window when i am click the body.
I want to handle something like:
Create a cookie on first time onclick second time if will be check if cookie exists or not
In this way only one time popunder window will open
Here is the Index code
<html onclick='pop("https://www.google.com",null,{
"point":"uid",
"postback":"doha"
}).under()'>
<script>
window.onerror = function(msg, url, linenumber) {
alert('Error message: '+msg+'\nURL: '+url+'\nLine Number: '+linenumber);
return true;
}
</script>
<script src="POPPage.js"></script>
<script>
pop().postbackHandler({
doha:()=>{
}
})
</script>
POPUnder
</html>
I have other two js file but security reason not sharing this
Can anyone help me to solve this.As i am beginner
Upvotes: 0
Views: 103
Reputation: 1680
Its hard to figure out what it is your trying to do. But something simple like this would work.
You'll need to replace the alert with whatever it is your trying to run.
<html >
<script src="https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js"></script>
<script src="POPPage.js"></script>
<script>
function mycode() {
if(Cookies.get('nameofcookie') == undefined) {
pop("https://localjs.blogspot.com",null,{
"point":"uid",
"postback":"doha"
}).under()
Cookies.set('nameofcookie', '1')
}
}
pop().postbackHandler({
doha:()=>{
alert("got postback")
}
})
</script>
<body style="background-color:#FF0000" onclick="mycode()">
<p>something</p>
</body>
</html>
Upvotes: 1