javascript 如何在 Chrome 中更改访问过的链接颜色?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32502127/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 15:22:51  来源:igfitidea点击:

How can I change the visited links color in Chrome?

javascriptcssgoogle-chromehyperlinkvisited

提问by ElCharly64

I use Google Chrome Browser and I find the unvisited and visited links colors are too close each other. They are very hard to distinguish, at least to me.

我使用 Google Chrome 浏览器,我发现未访问和访问的链接颜色彼此太接近。他们很难区分,至少对我来说是这样。

I tried the old approach of modifying the Custom.css configuration file in Chrome's user data folder and no change occurred.

我尝试了修改 Chrome 用户数据文件夹中的 Custom.css 配置文件的旧方法,但没有发生任何变化。

I'm open to solutions which include javascript code or css settings which I can run/modify in the developer's window (F12), even though they are not permanent settings.

我对包含 javascript 代码或 css 设置的解决方案持开放态度,我可以在开发人员窗口 (F12) 中运行/修改这些设置,即使它们不是永久设置。

回答by Vic Jang

Here's a solution that works for all platforms and for all versions of Chrome.

这是一个适用于所有平台和所有 Chrome 版本的解决方案。

  1. Install the Stylist extension
  2. Click SETTINGS in Chrome
  3. Click EXTENSIONS
  4. Find the Stylist extension and click OPTIONS
  5. Click STYLES
  6. Click ADD NEW STYLE
  7. Where it says "Style Name", name the style
  8. Click the ALL SITE check box
  9. Where it says "Stylesheet Text", copy and paste the following:
    A:visited { color: red ! important }
  10. Click SAVE
  11. Find a page with visited link, refresh, and you'll see the new color.
  1. 安装造型师扩展
  2. 单击 Chrome 中的设置
  3. 点击扩展
  4. 找到造型师扩展并单击选项
  5. 单击样式
  6. 单击添加新样式
  7. 在它说“样式名称”的地方,命名样式
  8. 单击所有站点复选框
  9. 在显示“样式表文本”的地方,复制并粘贴以下内容:
    A:visited { color: red ! important }
  10. 点击保存
  11. 找到一个有访问链接的页面,刷新,你会看到新的颜色。

You can find colors you like here, and you can also use a color code like rgb(255, 0, 0)in place of red.

您可以在此处找到您喜欢的颜色,也可以使用颜色代码rgb(255, 0, 0)代替red

Source

来源

回答by haslamjd

As of version 33 of chrome browser, the stylesheets are not available anymore. So your solution on your Windows 7 pathway to custom.css is invalid.

从 chrome 浏览器的 33 版开始,样式表不再可用。因此,您在 Windows 7 路径上的 custom.css 解决方案无效。

Meanwhile, I have not been able to find a solution for this oversight by Google for those of us with visual issues.

同时,对于我们这些有视觉问题的人,我无法为 Google 的这种疏忽找到解决方案。

回答by ibrahim orhan

Below worked for me, very good solution:

下面对我有用,非常好的解决方案:

"If you want to DIY extension:

“如果你想DIY扩展:

Create or Navigate to folder 'c:\Users[local user]\AppData\Local\Google\Chrome\UserData\Default\User StyleSheets\'

创建或导航到文件夹 'c:\Users[local user]\AppData\Local\Google\Chrome\UserData\Default\User StyleSheets\'

Create or edit 'Custom.css' within 'User StyleSheets':

在“用户样式表”中创建或编辑“Custom.css”:

A:visited, A:visited *{color:orchid !important}

A:访问过,A:访问过 *{color:orchid !important}

note: this code can also be used in @Vic Jang's answer.

注意:此代码也可用于@Vic Jang 的回答。

Create or edit 'manifest.json':

创建或编辑“manifest.json”:

{ "name": "my_custom_css", "version": "1", "content_scripts": [{ "matches": [":///*"], "css": ["Custom.css"] }], "manifest_version": 2 }

{ "name": "my_custom_css", "version": "1", "content_scripts": [{ "matches": [" :///*"], "css": ["Custom.css"] }] , "manifest_version": 2 }

goto URL with chrome: 'chrome://extensions'

使用 chrome 转到 URL:'chrome://extensions'

check the 'Developer mode' box

选中“开发者模式”框

click on 'Load unpacked extension...'

单击“加载解压缩的扩展程序...”

Navigate to the 'User StyleSheets' folder which contains the 'Custom.css' & 'manifest.json'

导航到包含“Custom.css”和“manifest.json”的“User StyleSheets”文件夹

check the 'Enabled' box next to the 'my_custom_css' extension you created

选中您创建的“my_custom_css”扩展旁边的“启用”框

restart chrome"

重新启动铬“

回答by user5719207

Found solution windows 7 and 10 Tested... https://chrome.google.com/webstore/detail/stylist/pabfempgigicdjjlccdgnbmeggkbjdhd/related?hl=en

找到解决方案 windows 7 和 10 测试... https://chrome.google.com/webstore/detail/stylist/pabfempgigicdjjlccdgnbmeggkbjdhd/related?hl=en

If you dont want to click the link here's how to do it

如果您不想单击此处的链接,请执行此操作

Randolph Knackstedt said: Someone just informed me about the Chrome extension, Stylist, which I highly recommend! https://chrome.google.com/webstore/detail/stylist/pabfempgigicdjjlccdgnbmeggkbjdhd/related?hl=en

Randolph Knackstedt 说: 刚刚有人告诉我有关 Chrome 扩展程序 Stylist 的信息,我强烈推荐它! https://chrome.google.com/webstore/detail/stylist/pabfempgigicdjjlccdgnbmeggkbjdhd/related?hl=en

This extension allows the user to select a custom visited link color and acts just as the custom.css did before the most recent Chrome update. Yay!

这个扩展允许用户选择自定义的访问链接颜色,就像在最近的 Chrome 更新之前 custom.css 所做的那样。耶!

After the extension is installed, do the following:

安装扩展后,执行以下操作:

--- click SETTINGS --- click EXTENSIONS --- find the stylist extension and click OPTIONS --- click STYLES --- click ADD NEW STYLE --- copy & paste the following: A:visited { color: red ! important } --- name the style --- click the ALL SITE check box --- click SAVE

--- 单击设置 --- 单击扩展名 --- 找到造型师扩展名并单击选项 --- 单击样式 --- 单击添加新样式 --- 复制并粘贴以下内容: A:visited { color: red ! 重要 } --- 命名样式 --- 单击 ALL SITE 复选框 --- 单击 SAVE

Now you have red visited links. You can pick a different color if you like.

现在你有红色的访问链接。如果你喜欢,你可以选择不同的颜色。

回答by Isaac Pak

This solution has worked for me for a good while now. It's another chrome extension, so if Stylish doesn't work for you, try Change Colors

这个解决方案已经对我来说有效了一段时间。这是另一个 chrome 扩展,所以如果 Stylish 不适合您,请尝试更改颜色

回答by xam

If you want to DIY extension:

如果你想DIY扩展:

  1. Create or Navigate to folder 'c:\Users[local user]\AppData\Local\Google\Chrome\UserData\Default\User StyleSheets\'

  2. Create or edit 'Custom.css' within 'User StyleSheets':

    A:visited, A:visited *{color:orchid !important}

    note: this code can also be used in @Vic Jang's answer.

  3. Create or edit 'manifest.json':

    { "name": "my_custom_css", "version": "1", "content_scripts": [{ "matches": ["*://*/*"], "css": ["Custom.css"] }], "manifest_version": 2 }

  4. goto URL with chrome: 'chrome://extensions'

  5. check the 'Developer mode' box

  6. click on 'Load unpacked extension...'

  7. Navigate to the 'User StyleSheets' folder which contains the 'Custom.css' & 'manifest.json'

  8. check the 'Enabled' box next to the 'my_custom_css' extension you created

  9. restart chrome

  1. 创建或导航到文件夹 'c:\Users[local user]\AppData\Local\Google\Chrome\UserData\Default\User StyleSheets\'

  2. 在“用户样式表”中创建或编辑“Custom.css”:

    A:visited, A:visited *{color:orchid !important}

    注意:此代码也可用于@Vic Jang 的回答。

  3. 创建或编辑“manifest.json”:

    { "name": "my_custom_css", "version": "1", "content_scripts": [{ "matches": ["*://*/*"], "css": ["Custom.css"] }], "manifest_version": 2 }

  4. 使用 chrome 转到 URL:'chrome://extensions'

  5. 选中“开发者模式”框

  6. 单击“加载解压缩的扩展程序...”

  7. 导航到包含“Custom.css”和“manifest.json”的“User StyleSheets”文件夹

  8. 选中您创建的“my_custom_css”扩展旁边的“启用”框

  9. 重启铬