创建独立于浏览器的书签或浏览器插件
创建一个可以在 IE、Firefox 和 Chrome 上无缝运行的浏览器插件或书签的最佳方法是什么?是否有一些谷歌小工具可以让您做到这一点?
What is the best way to create one browser addon or bookmarklet that would seamlessly work on IE, Firefox and chrome, is there some google gadget that would let you do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这一切都取决于您实际想要创建的内容。如果您的插件需要本地存储或使用 xPath 或其他浏览器特定项目之类的东西,那么在多个平台上无缝且正确地执行此操作不会非常容易。
一般来说,所有浏览器都有很大不同。 Chrome和Safari运行webkit,Firefox Gecko等。有些可以很好地支持 HTML5,有些则不能。如果您要创建复杂的内容,则必须为每个单独的浏览器执行此操作。然而,其中的大部分代码可以通过对另一个代码进行一些额外/不同的调用来重新调整用途。例如,Firefox 与 Chrome 和 Safari 有很多共同点,而 Chrome 和 Safari 的关系更为密切。
如果您的插件非常简单,我建议您只使用一个小书签,看看这个 http://www.smashingmagazine.com/2010/05/23/make-your-own-bookmarklets-with-jquery/ 使用 JQuery 将有助于解决一些问题您将遇到的所有浏览器特定问题。
如果您需要插件/扩展程序或书签,请尽可能使用 JQuery。
如果没有更多信息,我真的无法给出更具体的是或否答案。如果您可以详细说明您想要做的事情,也许会更容易帮助您。
This all depends on what you actually want to create. If your addon requires things like local storage or the use of xPath or other browser specific items than doing this seamlessly and correctly across the multiple platforms wouldn't be incredibly easy.
Generally speaking all the browsers are quite different. Chrome and Safari run webkit, Firefox Gecko and so on. Some support HTML5 well, others don't. If you're creating something complex you will have to do so for each individual browser. However, much of the code from one can be re-purposed with a few extra / different calls on another. Firefox for example has a lot in common with Chrome and Safari and Chrome and Safari are even more so closely related.
If your addon is very simple I'd recommend going with just a bookmarklet take a look at this http://www.smashingmagazine.com/2010/05/23/make-your-own-bookmarklets-with-jquery/ using JQuery will help solve some if not all of the browser specific issue's you'll run into.
If you require an addon/extension or a bookmarklet do it with JQuery where possible.
I can't really give a more specific yes or no answer without more information. If you could please expand on perhaps what you're looking to do it would be much easier to help you.