开发者

Is it possible to create a service to manipulate a webpage DOM dynamically?

Hi I am relatively new to this topic so I have no idea if this is possible. What I want to do is to create a widget which could be attached to the any web page other there dynamically. This w开发者_如何学编程idget has nothing to do with any web pages in particular but once the widget is created all the visitor of the web pages should be able to see this widget (is this possible?) I don't know where to start..... should this service be browser's plugin (addons) or is there a way to dynamically manipulate someone else's dom dynamically? Any thoughts, help etc would be a great help!

Thanks.


If I have understood your question correctly, you want to have a script that injects onto every webpage the user visits and displays a widget, correct?

You could create an add-on, although you would have to create a separate add-on for each browser you plan to support, and they can sometimes be a bit more complicated than they have to be for something as simple as script injection.

A better alternative is create a user script, which is basically a JavaScript file which is run whenever a vistor visits a website which matches a pattern that you specify (for instance, all websites they visit). Firefox has support for user scripts through the Greasemonkey extension, and Opera and Google Chrome has built-in support.

If you want to learn how to make your own user scripts, you can check out the Greasemonkey wiki or you can study some of the scripts

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜