0% found this document useful (0 votes)
27 views

popunder script for google

The document provides a JavaScript code snippet that creates a pop-under effect when links are clicked on a webpage. It checks if a certain time has passed since the last click and, if so, redirects to a specified URL while opening the clicked link in a new tab. Instructions are included for saving the script as a file, editing the URL, and integrating it into a website template.

Uploaded by

mega start
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

popunder script for google

The document provides a JavaScript code snippet that creates a pop-under effect when links are clicked on a webpage. It checks if a certain time has passed since the last click and, if so, redirects to a specified URL while opening the clicked link in a new tab. Instructions are included for saving the script as a file, editing the URL, and integrating it into a website template.

Uploaded by

mega start
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

<script>

window.onload = function() {
var puURL = 'http://google.com';
var puTS = Math.round(+new Date()/1000);
console.log('T.'+localStorage.puTS+'/'+puTS);
if (typeof localStorage.puTS == 'undefined' || parseInt(localStorage.puTS) <= (puTS - 3600)) {
var links = document.getElementsByTagName('a');
for(var i = 0, len = links.length; i < len; i++) {
links[i].onclick = function (e) {
var puHref = this.getAttribute("href");
var puTarget = this.getAttribute("target");
if (puHref !== '#' && puHref !== 'javascript:void(0)') {
e.preventDefault();
if (puTarget == '_blank') {
window.open(window.location.href);
}
window.open(puHref);
window.location.href = puURL;
localStorage.puTS = puTS;
}
}
}
}
};

</script>

Paste the code in the head section

:‫لو استطيع احط الكود الكبير في ملف مستقل يبقي افضل والطريقه كالتالي‬

window.onload = function() {
var puURL = 'http://google.com';
var puTS = Math.round(+new Date()/1000);
console.log('T.'+localStorage.puTS+'/'+puTS);
if (typeof localStorage.puTS == 'undefined' || parseInt(localStorage.puTS) <= (puTS - 3600)) {
var links = document.getElementsByTagName('a');
for(var i = 0, len = links.length; i < len; i++) {
links[i].onclick = function (e) {
var puHref = this.getAttribute("href");
var puTarget = this.getAttribute("target");
if (puHref !== '#' && puHref !== 'javascript:void(0)') {
e.preventDefault();
if (puTarget == '_blank') {
window.open(window.location.href);
}
window.open(puHref);
window.location.href = puURL;
localStorage.puTS = puTS;
}
}
}
}
};

Instructions
1. Copy code to a text editor and save as yourfile.js
2. Edit the var puURL on the second line to make it your affiliate link or any other link
3. Upload the file to your web server or host
4. Add the following to the head of your template file or if using a CMS google how to
include external Javascript files

<script type="text/javascript" src="//yoursite.com/yourfile.js"></script>

5. Click any link somewhere on the page. The puURL will open in the current tab and
the link will open in a new tab on top creating a pop under effect.
6. Test all links, menus etc. before deploying.

You might also like