blackantt 发表于 2023-6-1 08:05:51

已经解决: 链接里能否带上标记/标签,以便定位到长网页的具体位置

本帖最后由 blackantt 于 2023-6-1 11:20 编辑

看到一篇网页文章, 想转发给别人, 链接里能否带上标记/标签,以便看的人定位到长网页(网页里没有 id)的具体位置并 高亮 显示


已经解决,

比如想在http://dzb.hxnews.com/news/kx/202305/31/2119881.shtml 直接定位到 "朝鲜罕见向日本发通报 朝日对话有玄机"

方法如下:link#:~:text=关键词

http://dzb.hxnews.com/news/kx/202305/31/2119881.shtml#:~:text=朝鲜罕见向日本发通报 朝日对话有玄机


可能只对高版 chrome/edge 有效

歌者文明清理员 发表于 2023-6-1 08:11:33

本帖最后由 歌者文明清理员 于 2023-6-1 08:29 编辑

网页没有id你可以这样:
首先,ctrl+s保存网页。
打开html文件,找到你想跳转的位置,内容是xxx,改成<span id="ilovefishc">xxx</span>
然后把这个.html文件发出去,然后在提示打开html后,加上"#ilovefishc"(比如c:/users/xx/desktop/1.html->c:/users/xx/desktop/1.html#ilovefishc)

isdkz 发表于 2023-6-1 08:22:06

通常,如果网页中的某些部分有唯一的ID,我们可以通过在URL后添加#ID的方式来直接链接到该部分。但是,你提到网页没有ID标签,这种情况下,我们就不能使用这种方法了。

除非网页本身支持某种方式允许你在URL中添加特定位置的标记,否则很难直接在链接中指定网页的具体位置。例如,一些文档分享平台(如Google Docs)允许你创建直接链接到文档的特定部分的链接。

一种可能的解决方法是在转发链接时,另外说明具体位置,比如"请看第三段"或者"请看图4下面的文本"之类的。

另外,还有一些第三方的工具和插件可能可以帮助你实现这个功能,例如一些允许你高亮并分享特定网页部分的工具。但是使用这些工具需要注意隐私和安全问题,因为它们可能会收集并处理你的浏览数据。此外,接收链接的人也需要安装相同的插件才能看到你的标记。

总的来说,如果网页自身不提供定位功能,那么将特定位置的标记添加到链接中可能会比较困难。你可以考虑直接提供位置描述,或者使用第三方工具,但都有一定的局限性。

blackantt 发表于 2023-6-1 08:34:17

好像有办法了,

The upcoming Chrome "Scroll to text" feature is exactly what you are looking for....

https://github.com/bokand/ScrollToTextFragment

You basically add #targetText= at the end of the URL and the browser will scroll to the target text and highlight it after the page is loaded.

It is in the version of Chrome that is running on my desk, but currently it must be manually enabled. Presumably it will soon be enabled by default in the production Chrome builds and other browsers will follow, so OK to start adding to your links now and it will start working then.

Edit: It's been implemented in Chrome. See https://chromestatus.com/feature/4733392803332096

blackantt 发表于 2023-6-1 08:48:20

本帖最后由 blackantt 于 2023-6-1 08:58 编辑

blackantt 发表于 2023-6-1 08:34
好像有办法了,

The upcoming Chrome "Scroll to text" feature is exactly what you are looking for.. ...

比如想在http://dzb.hxnews.com/news/kx/202305/31/2119881.shtml 直接定位到 "朝鲜罕见向日本发通报 朝日对话有玄机"

方法如下:link#:~:text=关键词

http://dzb.hxnews.com/news/kx/202305/31/2119881.shtml#:~:text=朝鲜罕见向日本发通报 朝日对话有玄机
页: [1]
查看完整版本: 已经解决: 链接里能否带上标记/标签,以便定位到长网页的具体位置