- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在浏览器中点击页面后需要执行一段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 =])
关于javascript - 如何从java读取Bookmarklet?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32087556/
我是一名优秀的程序员,十分优秀!