gpt4 book ai didi

javascript - 如何从java读取Bookmarklet?

转载 作者:行者123 更新时间:2023-12-03 09:10:24 25 4
gpt4 key购买 nike

在浏览器中点击页面后需要执行一段Javascript。该 JavaScript 仅当它作为书签存储在浏览器中时才运行。我的任务是使用java代码执行浏览器书签中存储的javascript。

在 Google 上,我发现可以通过 java 代码为 URL 添加书签。但我不知道如何阅读书签。请建议我如何通过java代码读取它。

提前致谢!

最佳答案

有一个答案说除非你做浏览器扩展,否则不可能做到这一点:

Get browser bookmarks via javascript

虽然另一个答案讨论了上传浏览器书签文件并在 javascript 中读取它:

Inside the "...\Chrome\User Data\Default\" directory are two files. "Bookmarks", and "Bookmarks.bak". One is for your current bookmarks, and the other one (with the .bak extension) signifies that it is a bookmarks backup, if anything goes wrong. Bookmarks.bak gets overwritten every time you close Chrome.

Bookmarks in Chrome exist as a virtual filesystem. Meaning, that all your bookmarks are really just stored in one file, but appear as an actual filesystem inside Chrome.

You only have to copy that file, and back it up somewhere. And if you want to recovery your bookmarks, simply copy/paste the "Bookmarks" file you backed-up, back in to the directory you took it from.

Chrome must be closed prior to doing this.

Hope this helps.

(and btw, try opening the "Bookmarks" file with a text editor like Notepad =])

Location of chrome bookmarks

关于javascript - 如何从java读取Bookmarklet?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32087556/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com