The Most Active and Friendliest
Affiliate Marketing Community Online!

“Adavice”/  “1Win

How to create popup script

mi2

Member
Hi, I have a WordPress site and I want to add a (no plugins please) script that work just like we use other pop ads network. I mean visitor click on anywhere of my site a popunder or popup will open, I will put my offer link on destination link.

If that script can bypass adblock that will be great.

Please help me.
 
You can Use this

<script type="text/javascript">
window.open("http://www.yourwebsite.com", "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,top=500,left=500,width=400,height=400");
</script>

and trigger that with jquery onclick Event

Hi tyoussef, thank you very much, can you please write full script, actually I dont have enough knowledge on any kind of scripting, and I will put full code in head tag or in body tag? as I said this is a Wordpress site
 
<script>
var start;
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca;
while (c.charAt(0)==' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length,c.length);
}
}
return "";
}
function checkCookie(name) {
var cookieName=getCookie(name);
if (cookieName!="") {
return true;
} else {
return false;
}
}
jQuery(document).ready(function() {

var timeSeconds = new Date().getTime();
if(!checkCookie("UserSesssionTime"))
{
timeSeconds = Math.round(timeSeconds/1000);
setCookie("UserSesssionTime",timeSeconds,"12");
}

if(!checkCookie("popUpShows"))
{

window.open("http://www.yourwebsite.com", "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,top=500,left=500,width=400,height=400");


if(!checkCookie("popUpShows"))
{
setCookie("popUpShows","1","1");
}


});

});
</script>




i am so sleepy test this and see
by the way i didn't test it
if it's not working i will try get back tomorrow and take a look again
 
<script>
var start;
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca;
while (c.charAt(0)==' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length,c.length);
}
}
return "";
}
function checkCookie(name) {
var cookieName=getCookie(name);
if (cookieName!="") {
return true;
} else {
return false;
}
}
jQuery(document).ready(function() {

var timeSeconds = new Date().getTime();
if(!checkCookie("UserSesssionTime"))
{
timeSeconds = Math.round(timeSeconds/1000);
setCookie("UserSesssionTime",timeSeconds,"12");
}

if(!checkCookie("popUpShows"))
{

window.open("http://www.yourwebsite.com", "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,top=500,left=500,width=400,height=400");


if(!checkCookie("popUpShows"))
{
setCookie("popUpShows","1","1");
}


});

});
</script>




i am so sleepy test this and see
by the way i didn't test it
if it's not working i will try get back tomorrow and take a look again

Hi, thanks for full code, I put this code within body tag but not working for me.
 
For you, CSS Modal will work best. As they are simple, fast and use CSS at the back end.

Code:
// Get the modal
var modal = document.getElementById('myModal');

// Get the button that opens the modal
var btn = document.getElementById("myBtn");

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks on the button, open the modal
btn.onclick = function() {
    modal.style.display = "block";
}

// When the user clicks on <span> (x), close the modal
span.onclick = function() {
    modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
    if (event.target == modal) {
        modal.style.display = "none";
    }
}
 
For you, CSS Modal will work best. As they are simple, fast and use CSS at the back end.

Code:
// Get the modal
var modal = document.getElementById('myModal');

// Get the button that opens the modal
var btn = document.getElementById("myBtn");

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks on the button, open the modal
btn.onclick = function() {
    modal.style.display = "block";
}

// When the user clicks on <span> (x), close the modal
span.onclick = function() {
    modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
    if (event.target == modal) {
        modal.style.display = "none";
    }
}
Thanks I will test it
 
Try this.
Code:
<html>
<body>
<script type="text/javascript">
var newwindow;
function poptastic(url)
{
    newwindow=window.open(url,'name','height=400,width=600');
    if (window.focus) {newwindow.focus()}
}
</script>

<a class="" href="javascript:poptastic('https://www.google.com');">Help</a>
</body>
</html>
 
Zotabox is the best solution
There are many utilities for you to use
 
Last edited by a moderator:
MI
Back