对于Google Chrome浏览器的一般支持是OFF-TOPIC。 CHROME操作系统和铬是关闭主题。 google-chrome适用于与使用Chrome浏览器进行开发相关的问题。有关使用Chrome浏览器或配置Chrome浏览器的问题应发布在https://superuser.com上。有关[google-chrome-os]或[chromium]的问题应该使用这些标签。 Google Chrome浏览器是一种使用Blink渲染引擎的网络浏览器。
AutoHotKey v1 将每个按键发送到多个 Chrome 选项卡
我有以下脚本,旨在立即将用户按下的任何键转发到网页标题与 tabTitleA 和 tabTitl 匹配的所有 Chrome 选项卡(聚焦或未聚焦)...
登录 PayPal 时在 Google Chrome 上出现 500 内部服务器错误
每当我尝试在 Google Chrome 上访问登录 PayPal(我当前的版本是 35.0.1916.114,这是撰写本文时的最新版本)时,我会收到 500 内部服务器错误。这是
Chromecast 加密狗上运行的 Chrome 是否有任何 32 位扩展程序
我有一台电视,在 Chromecast 加密狗上显示来自安全网站的机器指标。我制作了一个网页,显示我们商店的 5S 仪表板。我希望能够从机器指标切换
我编写了一个程序,生成带有以下标头的 html 文件: 但我根本没有 iframe,更不用说在沙盒中了 当我在浏览器(托管在 Jenkins 服务器上)中打开页面时,我看不到 css。
如何在 Google Chrome 中设置模拟设备以使其看起来像 A4 页面?
我有一个使用 Bootstrap 4 的网站。我正在尝试修改 CSS,以便当我将页面打印为 PDF 时,它看起来像我想要的那样。 我找到了渲染选项来启用模拟 CSS 媒体...
我有一个用 Manifest V3 编写的 Chrome 扩展程序,当用户单击 Chrome 工具栏中的扩展程序图标时,它会打开一个侧面板。我希望侧面板在所有具有...的选项卡上保持打开状态
为什么Chrome中资源的缓存时间是Date加上max-age的结果
我发现了一个奇怪的问题,这让我很困惑。我有一个 html 页面包含托管在 cdn 服务器上的图像 url,在第一次请求时(就在我上传图像之前),响应
我最近在 Google Chrome 浏览器中遇到了奇怪的行为。 图像看起来像素化和破碎,但它们出现在屏幕截图上并滚动,所以它一定是浏览器而不是我的笔记本电脑......
Windows XP(32 位和 64 位)支持的最高版本浏览器(Google Chrome、Opera)是什么? 我发现IE7是XP支持的最高版本,但其他版本找不到。
我需要一个脚本来启动 Google Chrome,然后发送信号让它进入全屏模式(通常通过按 f11 完成)。 Chrome 已安装到默认位置。 一个例子...
在 javascript 严格模式下,某些赋值会默默失败(Chrome)
MDN 中的严格模式定义如下 正常代码中任何默默失败的分配(分配给 不可写属性,分配给仅吸气剂属性, 分配给新的
Chrome Javascript 控制台 - 使用 console.log(obj) 引用对象输出?
有没有办法获取对输出到 chrome 控制台的对象的 javascript 引用? 例如,假设我有以下 JavaScript: top.it = {hi:'那里'}; console.log(top.it); 这...
如何在 Chrome 中模仿 Greasemonkey/Firefox 的 unsafeWindow 功能?
我现在只是在 chrome 中摆弄用户脚本,所以请容忍我潜在的无知/白痴。 在我正在为其编写脚本的页面中,有一个 元素声明...</desc> <question vote="7"> <p>我现在只是在 chrome 中摆弄用户脚本,所以请容忍我潜在的无知/白痴。</p> <p>在我正在为其编写脚本的页面中,有一个 <pre><code><script></code></pre> 元素声明了一个变量 <pre><code>x</code></pre>。 这是否意味着,在我的用户脚本中,我只能从全局命名空间访问<pre><code>x</code></pre>?</p> <p>例如,如果我的用户脚本中的唯一行是 <pre><code>alert(x);</code></pre>,它是否应该按预期工作(假设 <pre><code>x</code></pre> 是一个字符串)?我知道 chrome 不支持 unsafewindow,但由于某种原因,我发现不可能弄清楚如何模仿该功能。还可能吗?</p> </question> <answer tick="false" vote="13"> <p>这将为您提供对窗口对象的引用(如 p):</p> <pre><code>var p = unsafeWindow; if(window.navigator.vendor.match(/Google/)) { var div = document.createElement("div"); div.setAttribute("onclick", "return window;"); p = div.onclick(); }; </code></pre> </answer> <answer tick="false" vote="11"> <p><strong>更新:</strong><br/> <pre><code>onclick</code></pre> 漏洞在最新的 Chrome 版本中不再起作用。</p> <p>要在 Chrome 中获得 <pre><code>unsafeWindow</code></pre> 功能,最好的选择是安装并使用 <a href="https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo" rel="nofollow noreferrer">Tampermonkey</a> ——无论如何,你应该明智地这样做。 Tampermonkey 完全支持 Greasemonkey API,并且脚本管理更加简单。</p> <p>Greasemonkey 脚本和 Tampermonkey 脚本几乎总是完全兼容,但对于普通 Chrome 用户脚本来说并非如此。</p> <p>放弃 Tampermonkey,唯一仍然有效的替代方案是使用某种形式的 <a href="https://stackoverflow.com/a/13485650/331508">脚本注入</a>。</p> <p><br/></p> <hr/> <p><strong>以下内容现已过时:</strong> </p> <p><a href="https://stackoverflow.com/a/10828021/331508">Chrome 现在为用户脚本/内容脚本<pre>定义了 </pre><code>unsafeWindow</code></a>,但 Chrome 的 <pre><code>unsafeWindow</code></pre> 仍然不允许访问目标页面创建的 JS 对象。</p> <p>以下是如何提供适当的不安全,<pre><code>unsafeWindow</code></pre>——以跨浏览器的方式,使用<a href="https://stackoverflow.com/a/1294765/331508"><em>特征检测</em>(好)与<em>浏览器嗅探</em>(坏)</a>:</p> <pre><code>/*--- Create a proper unsafeWindow object on browsers where it doesn't exist (Chrome, mainly). Chrome now defines unsafeWindow, but does not give it the same access to a page's javascript that a properly unsafe, unsafeWindow has. This code remedies that. */ var bGreasemonkeyServiceDefined = false; try { if (typeof Components.interfaces.gmIGreasemonkeyService === "object") { bGreasemonkeyServiceDefined = true; } } catch (err) { //Ignore. } if ( typeof unsafeWindow === "undefined" || ! bGreasemonkeyServiceDefined) { unsafeWindow = ( function () { var dummyElem = document.createElement('p'); dummyElem.setAttribute ('onclick', 'return window;'); return dummyElem.onclick (); } ) (); } </code></pre> </answer> <answer tick="true" vote="9"> <p><pre><code>contentWindow</code></pre> 在 Chrome 3 中可用,但 <a href="http://groups.google.com/group/chromium-extensions/browse_thread/thread/a4ff886cfecf80ca" rel="nofollow noreferrer">在 Chrome 4 中被删除</a>。 Chrome 4 唯一可能的解决方案:</p> <pre><code>location.href="javascript:(function(){ alert('Hello'); })()" </code></pre> </answer> <answer tick="false" vote="1"> <p>如果您想与页面 JavaScript 交互,则必须将脚本插入页面中。 (当然,除非您想使用本页建议的任何技巧。)我已经编写了一个函数来为我自己的脚本执行此操作,我会将其发布在这里,以防有人想要使用它。</p> <pre><code>/* @description This function will insert the given code as a <script> or <style> block into a page. @param The code to insert; supported types are: JavaScript Function, String (JavaScript), String (CSS). @param2 Optional: The type of code that is inserted. If omitted, "js" is assumed. Possible values are 'js' or 'css'. @return The HTML element that was inserted, or FALSE on failure */ function insert(z,t){ var j,f,x,c,i,n,d d=document c=d.createElement i=d.head.appendChild a=d.createTextNode if(typeof z==='function') j=!0,f=!0; if((t=='js'||!t)&&!f){j=!0,f=!1} if(t=='css'&&!j){x=c('style');x.setAttribute('type','text/css')} if(j){x=c('script');x.setAttribute('type','text/javascript')} if(f) n=a('('+z+')()');else n=a(z) x.appendChild(n) if(x){return i(x)}else{return !1} } </code></pre> <p>几个需要澄清的例子:</p> <pre><code>//Inserting a JavaScript function var func=function(){ stopAds(); startFileDownload(); } insert(func); //Inserting JavaScript as a string var strJS="prompt(\"Copy:\",someVariableAtThePage);"; insert(strJS); //Or with an OPTIONAL 2nd parameter: insert(strJS,'js'); //Inserting CSS var strCSS=".ad{display:none !important} #downloadButton{display:block}"; insert(strCSS,'css');//Specifying 2nd parameter as "css" is required. </code></pre> </answer> <answer tick="false" vote="0"> <p>好的,这是一个想法,您可以使用地址栏注入脚本...</p> <pre><code>javascript:var ElEm = document.createElement("script");ElEm.src='[path_to_script]';document.body.appendChild(ElEm); </code></pre> <p>然后你可以用你的javascript在窗口中运行你想要的任何内容</p> </answer> <answer tick="false" vote="0"> <p>@Johan 的答案中的脚本非常酷且有用。但我需要它并且想看到它<strong>去混淆</strong>。</p> <p>对于那些像我一样想要查看它或以可读格式使用它的人,就在这里。这是 <strong>same</strong> 函数,只是为了清晰起见进行了一些重构。这可能有助于更快地理解甚至分叉:</p> <pre><code>function insert(code, tipo) { let isJS, isFunc, x, n; if (typeof code === "function") { isJS = true; isFunc = true; } if ((tipo === "js" || !tipo) && !isFunc) { (isJS = true), (isFunc = false); } if (tipo === "css" && !isJS) { x = document.createElement("style"); x.setAttribute("type", "text/css"); } if (isJS) { x = document.createElement("script"); x.setAttribute("type", "text/javascript"); } if (isFunc) n = document.createTextNode("(" + code + ")()"); else n = document.createTextNode(code); x.appendChild(n); if (x) { return document.head.appendChild(x); } else { return false; } } </code></pre> </answer> </body></html>
WebRTC onicecandidate 永远不会在 chrome 中触发
我的 webrtc Web 应用程序从不触发 onicecandidate()。 当我查看本地(Webrtc 对象)对象时,会设置本地描述和远程描述。 在 Firefox 中,它会触发 onicecandidate() 但 event.can...
Nextjs 图像:使用链接预加载进行预加载,但在窗口加载事件后几秒钟内未使用
我正在使用 Nextjs ,一个基于 React 的框架,我正在尝试在 Next.js 提供的 Image 组件中显示 logo.png 图像。 我有这个文件夹:public/img 这是我的代码: 我正在使用 Nextjs ,一个基于 React 的框架,我正在尝试在 Next.js 提供的 Image 组件中显示 logo.png 图像。 我有这个文件夹:public/img 这是我的代码: <Image src={'/img/logo.png'} width='154' height='82' alt='logo' layout='responsive' priority={true} /> 我在控制台中收到此错误: 资源 http://localhost:3001/_next/image?url=%2Fimg%2Flogo.png&w=640&q=75 是 使用链接预加载进行预加载,但在几秒钟内未使用 窗口的加载事件。请确保它有合适的 as 值并且是有意预加载的。 有什么帮助吗? 向下一个图像添加“placeholder”和“blurDataURL”道具并删除“priority”道具,有助于解决此问题 <Image src={'/img/logo.png'} width='154' height='82' alt='logo' placeholder="blur" blurDataURL={'/img/logo.png'} /> 我删除了布局标签,因为我使用的是 Next.js 版本 13.1.1 如果上述方法不起作用,请确保您传递了 Sizes 属性 尺寸=“(最大宽度:768px)100vw,(最大宽度:1200px)50vw,33vw” 从文档中阅读更多内容 提供有关图像在不同断点处的宽度的信息的字符串。尺寸的值将极大地影响使用填充或样式为具有响应尺寸的图像的性能 例如,如果您知道您的样式会导致图像在移动设备上为全宽、在平板电脑上为 2 列布局、在桌面显示器上为 3 列布局,则应包含尺寸属性,例如以下: import Image from 'next/image' const Example = () => ( <div className="grid-element"> <Image src="/example.png" fill sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw" /> </div> ) 此示例的大小可能会对性能指标产生巨大影响。如果没有 33vw 大小,从服务器选择的图像宽度将是所需宽度的 3 倍。由于文件大小与宽度的平方成正比,如果没有大小,用户将下载比所需大小大 9 倍的图像。 为我解决这个问题的事情实际上在 Next.js Image Github 中有所暗示。 如果您尝试将实际源路径作为 src 的值,它将不起作用。 为了使用 src,您需要导入它: import frank from '/public/frank-banner.png'; 这样当你真正在Image组件中使用它时: <Image src={frank} width={xx} height={xx}/> 如果您使用链接,只需添加 as='image' 像这样 <Link href="/" as={'image'}> <Image priority={true} src="/images/profile.jpg" className={utilStyles.borderCircle} height={108} width={108} alt="" /> </Link> 只需添加as='image',就可以解决我的问题 只需将优先级设置为“true”,相当于 rel="preload"。 Html 中预加载的图像 <link rel="preload" as="image" href="image.jpg"> 下一个: <Image src="/images/image.jpg" width="800" height="600" priority={true} /> 问题出在 chrome 的预加载上,因为它会加载未使用的图像。但加载是正确的。 自从这个小修正后,我就不再有错误消息了 以下是一些来源: https://github.com/GoogleChromeLabs/preload-webpack-plugin/issues/8 https://abstack.pk/post/learn-how-to-preload-images-in-nextjs 享受 在 ThemeContextProvider (./src/context/Themecontext.jsx:20:78) 摘要:“2350462168” 7 | const getFormLocalStorage = () => { 8 | if(窗口类型!==未定义){ 9 | const value = localStorage.getItem("主题"); | ^ 10 | 10返回值|| “光”; 11 | 11 }
我想在特定页面使用 JavaScript 禁用 Chrome 扩展程序中的 Enter 键。例如:在登录页面上,用户不应按 Enter 登录,而应单击“登录”按钮...
这个问题不存在,因为有关于使用 localhost 从 Django 向 google 发送消息的新消息。我知道要将消息从本地主机发送到谷歌,我应该启动“l...
从服务器收到重复的标头 来自服务器的响应包含重复的标头。此问题通常是由于网站或代理配置错误造成的。仅网站或代理
Chrome 上 msSaveOrOpenBlob 的替代方案
我需要找到“msSaveOrOpenBlob”的替代品 “,这适用于 IE、Firefox 和 Chrome。特别是在 Chrome 上,它不起作用,并且不显示选择保存或打开文件的对话框...
目前我正在尝试“访问”Google Chrome 开发工具中的网络选项卡,并希望在那里获取一些 XHR / 重定向信息。我正在测试我的代码,我可以获得访问权限...