简体   繁体   中英

How do I redirect a page with Anonymizer link to the contained URL

Due to multiple scripts I have on the target domain I want to redirect the anonymized link directly to the page with a GreaseMonkey script: Currently it does not work but my Javascript experience is outdated, so I need a little help.

Example with LinkBlur but other link anonymers should be same stuff:

http://linkblur.com/?http://www.yahoo.com

This is the script I tried to make but did not work:

var loc = window.location.href;
var reg = /[?](.*)/gi;
var correcturl = loc.match(reg).substring(1);
window.location = correcturl;

Thanks for the attention and please point out if there are any errors.

LinkBlur, and most of these sites, use frames or iFrames; your script must account for that.

Also it will crash frequently because the return from match() is not being checked properly.

This works:

if (window.top != window.self)  //-- Don't run on frames or iframes.
    return;

var loc         = window.location.href;
var correcturl  = loc.match (/\?(.+)/i);

if (correcturl  &&  correcturl[1]) {
    window.location = correcturl [1];
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM