我有很多下载链接是为我的用户在我的网站中提供的,我希望为这些链接添加特定的参考链接。例如:jQuery在链接中添加域名
http://rapidgator.net/file/xxxx
现在我想用jQuery在每个外部链接的链接前添加我的对象链接。我搜索,只发现了jQuery为attr
:
jQuery('a[href*="http://"]:not([href*="http://www.mysite.com"])').attr('rel', 'nofollow');
但在我的情况下,我想添加我的域名中的链接的前面,这样网址:
<a href="http://rapidgator.net/file/xxxx">http://rapidgator.net/file/xxxx</a>
将变为:
<a href="http://myspecificdomain.com?ref=http://rapidgator.net/file/xxx">http://rapidgator.net/file/xxxx</a>
这可以使用jQuery来完成吗?
谢谢你,我记住这是非常简单的,而不是与实际演示困惑锚.. 。谢谢Sari Alalen –
这实际上是我12分钟后发布的答案。 – Charlie