[英]Where is this CSS file coming from?
Repro steps: 复制步骤:
default.css
看到一些属性是从名为default.css
的样式表继承的 Where is default.css? default.css在哪里? I know it's found here , but where is it being referenced on RMC's site? 我知道可以在这里找到它,但是RMC的站点在哪里引用了它?
Looking at the code I see the class name .gsc-search-box
then i did a google search for that class name and found this SO question . 查看代码,我看到了类名.gsc-search-box
然后我在Google上搜索了该类名并发现了这个问题 。 That lead me to find the Google custom search box which you can read more about here: https://www.google.com/cse/ 这使我找到了Google自定义搜索框,您可以在此处了解更多信息: https : //www.google.com/cse/
It is from Googles Custom Search Engine CSS . 它来自Google的自定义搜索引擎CSS 。
The description of this product is located here 该产品的描述位于这里
It comes from this javascript file . 它来自此javascript文件 。
If you look at your Google Chrome developer tools you'll see the following "initiator" column: 如果您使用Google Chrome开发人员工具,则会看到以下“启动器”列:
If you hover over the URL, you'll see the following: 如果将鼠标悬停在URL上,则会看到以下内容:
google.(anonymous function).d @ jsapi?autoload={"modules"%3A[{"name"%3A"search"%2C"version"%3A"1.0"%2C"callback"%3A"__gcse.scb"%2C"…:21
(anonymous function) @ ?file=search&v=1.0&hl=en&async=2&style=https%3A%2F%2Fwww.google.com%2Fcse%2Fstyle%2Flook%2Fv2%2Fdef…:10
So essentially it's loaded by Google CSE's d
function. 因此,基本上,它是由Google CSE的d
函数加载的。
If we look closer at that we'll see: 如果我们仔细观察,将会看到:
google[z].d = function(a, b, c) {
if (c) {
var e;
"script" == a ? (e = h.createElement("script"), e.type = "text/javascript", e.src = b) : "css" == a && (e = h.createElement("link"), e.type = "text/css", e.href = b, e.rel = "stylesheet");
(a = h.getElementsByTagName("head")[0]) || (a = h.body.parentNode.appendChild(h.createElement("head")));
a.appendChild(e)
} else
"script" == a ? h.write('<script src="' + b + '" type="text/javascript">\x3c/script>') : "css" == a && h.write('<link href="' + b + '" type="text/css" rel="stylesheet"></link>')
};
Where it adds it to the header. 将其添加到标头的位置。
If we look at the (anonymous function)
we'll find the following: 如果我们看一下(anonymous function)
,将会发现以下内容:
google.loader.writeLoadTag("css", "https://www.google.com/cse/style/look/v2/default.css", true);
Which is where it's coming from. 它来自哪里。
But where is CSE added?! 但是CSE添加在哪里?
Right on the source of the HTML page you were looking at: 在您正在查看的HTML页面的源代码上:
<script>
(function() {
var cx = '018180480343835782597:0w0lu0vrv_i';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.