[Question] Sanitize Google alerts.

Amsterdammer

Power Member
Joined
Aug 9, 2011
Messages
516
Reaction score
566
Hi,

I am trying to sanitize google alerts as I like my privacy, the result is a very ugly script that works on some links but not all.
Yahoo answers for instance will not work and I can't figure out why.

Any help would be appreciated. :)

EDIT: I found the problem, this now works on the links tested, no promises at all for other links but I hope this script will help someone.

Code:
<html>
<head>
</head>
<body>
<h>A small script to sanitize  links from alerts</h>
<br/><br/>
<form name="inputs" >
Paste the link here: <input type="text" name="link">
<input type="button" onclick="sanitize()" value="Sanitize" />
</form>
<br/><br/>
<p id="Output">No link was sanitized yet...</p>
<br/><br/>
<p id="originalLink">This line will be replaced by your input. Stop reading and start pasting!</p>

<script>
function sanitize(){
    var draadje=document.forms["inputs"]["link"].value;
    var y= new String;
         y= draadje;
    var begin=y.lastIndexOf("http://");
    var ending="&ct="
    var einde=y.indexOf(ending);
    var tempresultaat=y.slice(begin,einde);
    tempresultaat=tempresultaat.replace("%3F","?");    
    var a='<a href="';
    var b=tempresultaat;
    var c='">';
    var d=tempresultaat;
    var e="</a>";
    var resultaat=document.getElementById("Output").innerHTML=("Your link is: <br/>" + a + b + c + d + e )
    document.getElementById("originalLink").innerHTML=("The original link was: <br/>" + a + y + c + y + e);
}
</script>
</body>
</html>
 
Last edited:
Back
Top