链接到缺乏适用锚点的网页的特定部分 [英] Linking to a specific part of a web page that lacks an applicable anchor

查看:35
本文介绍了链接到缺乏适用锚点的网页的特定部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

链接到网页的特定部分有没有办法在没有锚点的情况下添加书签或链接到页面的某个部分? 有回答/评论说无法链接到页面的特定部分除非 该页面中包含可寻址项目,例如锚点.

Linking to a specific part of a web page and Is there any way to bookmark or link to a section of a page without an anchor? have answers/comments that say that linking to a particular part of a page cannot be done unless that page has addressable items in it such as anchors.

但我真的需要这个用于研究:我需要将 URL 粘贴到任意页面中的任意部分,而不要求该页面具有锚点(例如,我想要一个基本上指向 http://www.zdnet.com/article/google-voice-beyond-gmail-get-voicemail-and-texts-using-any-email-client-you-want/ 并向下搜索过滤器是你的朋友")

But I'm really needing this for research: I need to paste URLs to any arbitrary section in any arbitrary page without requiring that page to have anchors (e.g., I would like a URL that essentially goes to http://www.zdnet.com/article/google-voice-beyond-gmail-get-voicemail-and-texts-using-any-email-client-you-want/ and searches down for "Filters are your friends")

我需要它以与浏览器无关的方式工作,不需要浏览器扩展(例如,http://liveurls.mozdev.org/tech.htmlhttps://stackoverflow.com/a/26590905/引用257924),不需要在 URL 本身内使用 Javascript,因为明显和正确的安全问题将不会执行,并且不需要跨站点脚本 (https://stackoverflow.com/a/13294569/257924).

I need this to work in a browser-agnostic manner, not requiring browser extensions (e.g., http://liveurls.mozdev.org/tech.html as referenced by https://stackoverflow.com/a/26590905/257924), not requiring use of Javascript inside the URL itself which will not execute due to obvious and correct security concerns, and not requiring cross-site scripting (https://stackoverflow.com/a/13294569/257924).

是否有其他方法可以做到这一点,例如某些外部网站提供了一种在页面缺少锚点时形成指向页面内任意文本字符串的链接的方法?

Is there some other way to do it such as some external website that provides a way to form a link to an arbitrary string of text within a page when that page lacks an anchor?

推荐答案

Chrome( 74.0.3706.0 之后)有一个实验性功能 ScrollToTextFragment 这正是你想要的

Chrome(later than 74.0.3706.0) has an experimental feature ScrollToTextFragment which does exactly what you want

为了能够直接滚动到网页的特定部分,我们建议推广现有的基于片段标识符滚动到元素的支持.我们相信此功能可被各种网站(例如搜索引擎结果页面、维基百科参考链接)以及最终用户在从浏览器共享链接时使用.

To enable scrolling directly to a specific part of a web page, we propose generalizing the existing support for scrolling to elements based on the fragment identifier. We believe this capability could be used by a variety of websites (e.g. search engine results pages, Wikipedia reference links), as well as by end users when sharing links from a browser.

...

链接有时用作网页中的引用,作者希望通过引用另一个页面(例如维基百科中的引用)来证实声明.这些参考页面通常很大,因此找到支持该主张的确切段落可能非常耗时.通过链接到支持其基本主张的段落,作者可以让读者更有效地理解他们的整体论点.

Links are sometimes used as citations in web pages where the author wishes to substantiate a claim by referencing another page (e.g. references in wikipedia). These reference pages can often be large, so finding the exact passage that supports the claim can be very time consuming. By linking to the passage that supports their underlying claim, authors can make it more efficient for readers to follow their overall argument.

但用户必须手动开启此实验性功能.

but the user have to turn on this experimental feature manually.

此功能目前在 Chrome 74.0.3706.0 和更新版本中作为实验性功能实现.默认情况下,它尚未交付给用户.希望试用它的用户可以使用 chrome://flags#enable-text-fragment-anchor.实现不完整,不一定符合本文档中的规范.

This feature is currently implemented as an experimental feature in Chrome 74.0.3706.0 and newer. It is not yet shipped to users by default. Users who wish to experiment with it can use chrome://flags#enable-text-fragment-anchor. The implementation is incomplete and doesn't necessarily match the specification in this document.

这篇关于链接到缺乏适用锚点的网页的特定部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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