Home > Technical & Creative Skills > Programming, Servers & Scripts

Trying to understand this javascript... (5)


07-07-2017 04:52 AM #1 saigonscott (Member)
Trying to understand this javascript...

Found this in a landing page we ripped. What is the general thing going on here? My guess was this is some sort of replace your link script?


<script type="text/javascript">


navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate;
window.onload = function(){ navigator.vibrate([1500, 100, 1500, 100]); }

var fakepath="?rzi=677949&rsz=677949&rid=";

window.history.pushState('index.php', 'gogogo', fakepath);
window.history.pushState('index.php', 'disone', fakepath);


window.addEventListener("popstate", function(e){if(document.URL.indexOf(fakepath) >= 0){
window.history.pushState('index.php', 'gogogo', fakepath);
window.history.pushState('index.php', 'disone', fakepath);
if (document.getElementById('snd')) {
document.getElementById('snd').play();navigator.vi brate([1500]);
}
alert('Atualização é altamente recomendável!');
}});


</script>


07-07-2017 09:46 AM #2 foussama (Member)

Hi,

This is a script for mobile I think (source), and it's not working correctly since there's a space in this line :

document.getElementById('snd').play();navigator.vi brate([1500]);
This script looks like it's a back button redirect, taking the user to "/index.php??rzi=677949&rsz=677949&rid=" when he hits the back button of his device (source)

Hope I helped in someway.


07-07-2017 11:54 AM #3 erikgyepes (Moderator)

This script does a few things:

- it vibrates the phone
- back button redirection
- alert (popup)


07-08-2017 10:03 AM #4 manu_adefy (Veteran Member)

window.history.pushState('index.php', 'gogogo', fakepath);
window.history.pushState('index.php', 'disone', fakepath);
This part also changes what the browser URL field shows, and most often also the referrer. You can fake the referrer on most browsers this way.


07-10-2017 07:45 AM #5 saigonscott (Member)

Appreciate it guys.


Home > Technical & Creative Skills > Programming, Servers & Scripts