我使用下面的代码添加"rel=“标签到某些附属链接。虽然这段代码可以很好地处理文本链接,但是它不适用于按钮链接。
有人知道如何更新按钮链接的代码吗?
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script><script type="text/javascript">
$(document).ready(function() {
$("a").each(function(){
if($(this).attr("href").indexOf("amazon") != -1
|| $(this).attr("href").indexOf("amzn") != -1) {
$(this).attr("rel","sponsored noopener");
}
});
});
</script>发布于 2022-05-10 12:29:53
我在Automanila.com中使用这段代码,您可以检查
https://stackoverflow.com/questions/72180156
复制相似问题