Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 如何在用户样式表中选择跨域链接?_Css_Google Chrome_Cross Domain - Fatal编程技术网

Css 如何在用户样式表中选择跨域链接?

Css 如何在用户样式表中选择跨域链接?,css,google-chrome,cross-domain,Css,Google Chrome,Cross Domain,使用用户样式表,我想在任何链接之前放置一个特殊图标,该链接将我带到任何网站的不同域(例如,example.com到example1.example.com,example.com到stackoverflow.com,example.com到example.com:80,**到等,但不example.com/patha到example.com/pathb)。我该怎么做?我已经知道,要将图像放在链接之前,我必须使用 a:before { content:url(path/to/icon.png);

使用用户样式表,我想在任何链接之前放置一个特殊图标,该链接将我带到任何网站的不同域(例如,example.com到example1.example.com,example.com到stackoverflow.com,example.com到example.com:80,**到等,但不example.com/patha到example.com/pathb)。我该怎么做?我已经知道,要将图像放在链接之前,我必须使用

a:before
{
content:url(path/to/icon.png);
}
我已经尝试过,并确保它的工作,但我如何使它只选择跨域链接?我的局限性在于Chrome中的用户样式表,这意味着没有脚本,除非我可以指定用户编写的脚本而不将其转换为扩展。 我曾经尝试过
a[href^=http]:在
之前,但a)不是每个网站都将协议放在URL前面,b)网站可以使用协议链接到自己


谢谢

我找到了解决你问题的完美办法

不幸的是,它在CSS4中,我们仍在等待所有CSS3

下面是代码,如中所示

a:not(:local-link(0)):before {
    content:url(path/to/icon.png);
}