我的页面中有一些外部链接
<a href="http://example.com/link-1" class="ext">Label</a>
<a href="http://example.com/link-2" class="ext">Label</a>
ext
链接到退出页,然后自动将其重定向到目标。它工作得很好,但是有多个
提取
页面上的链接,我的脚本正在获取
href
link-1
对于其他
链接也是。
因此:
// To grab the href of the destination page i.e http://example.com/link-1
var external = $(".ext").attr('href');
// To forward to the exit page first i.e http://localhost/checkLinkURL?=http://example.com/link-1
$(".ext").attr('href', 'http://localhost/checkLinkURL?=' + external);
each
但它仍然只得到
href公司
属于
链路-1
每个