URL 中的 `#:~:text=` 位置哈希到底是什么? [英] What exactly is the `#:~:text=` location hash in an URL?

查看:70
本文介绍了URL 中的 `#:~:text=` 位置哈希到底是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我注意到 Google 上的一些搜索给了我指向结果的链接,其中包含突出显示文本的明显说明.

Google 带我到

我进一步试验了一下,这似乎是 Google Chrome 的一个功能.如果将 #:~:text=something 附加到 URL,它会突出显示页面上的文本.

text这个词加上不同的字符很难用谷歌搜索,所以我找不到关于这个主题的任何东西.

要了解有关此类URL 黑客"的更多信息,请参阅我想知道:
谷歌浏览器的这项功能叫什么?

解决方案

Scroll To Text Fragment

好的,在朋友的帮助下,同时通过来自

突出显示整段文本

您可以使用 #:~:text=, 突出显示整个文本部分.

示例:

更高级的技术

Today I noticed that some searches on Google gave me links to results with apparent instructions to highlight text.

Google brought me to What is the maximum size of a zip file on Windows 10 Pro 64...:

I experimented a little bit further and this seems to be a feature of Google Chrome. It highlights text on the page if you append #:~:text=something to the URL. https://example.com/#:~:text=domain seems to work fine, but only on Chrome (Chrome Beta on the left, Firefox on the right).

The word text together with different characters is a bit hard to google, so I couldn't find anything on the subject.

For finding out more information about these kinds of "URL-hacks" I want to know:
What is this feature of Google Chrome called?

解决方案

Scroll To Text Fragment

OK, with the help of a friend and at the same time via a comment from Berto99 I found it:

Apparently this is a feature called Scroll To Text Fragment. It is enabled by default since Chrome 80, but apparently not yet implemented in other browsers.

There are quite nice examples in the "W3C Community Group Draft Report". More good examples can be found on Wikipedia.

Highlighting the first appearance of a certain text

Just append #:~:text=<text> to the URL. The text search is not case-sensitive.

Example: https://example.com#:~:text=domain

Highlighting a whole section of text

You can use #:~:text=<first word>,<last word> to highlight a whole section of text.

Example: https://stackoverflow.com/questions/62161819/what-exactly-is-the-text-location-hash-in-an-url/62162093#:~:text=Apparently,Wikipedia

More advanced techniques

这篇关于URL 中的 `#:~:text=` 位置哈希到底是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆