替换为当前域
Replace by current domain
我有一个 link : http://fakedomain.net/path
我想将 link 动态替换为 当前域 名称,如下所示:http://currentdomain.com/path
$('.link a').each(function(){
this.href = this.href.replace('http://fakedomaine.net/', WHAT_GOES_HERE);
});
但是此时我被屏蔽了
试试这个
this.href = this.href.replace('http://fakedomaine.net',
location.protocol+"//"+location.host);
我有一个 link : http://fakedomain.net/path
我想将 link 动态替换为 当前域 名称,如下所示:http://currentdomain.com/path
$('.link a').each(function(){
this.href = this.href.replace('http://fakedomaine.net/', WHAT_GOES_HERE);
});
但是此时我被屏蔽了
试试这个
this.href = this.href.replace('http://fakedomaine.net',
location.protocol+"//"+location.host);