There's an interesting question I would like to ask. I am currently working on a project that starts showing a toolbar at the bottom of the page on all the webistes, after the user's script installarion in the browser plugin. Let's say he had greasemonkey installed and he installed a script because of which a toolbar appear at the bottom of the websites he visit.
The toolbar is actually a .html file that is fetched from the server after the request by the user and appears as an iframe into the browser. Say, the toolbar a drop down menu which has three items out of which the user clicks on the first one. When the user clicks on this item, the request is sent to the same server from where the .html file was downloaded and according the option chosen by the user, a jSON file is produced on a ASP.NET page. This JSON page is read (using AJAX techniqeus) and according to the options in the json, a jQuery file is fetched and page adjustments are made. I am able to complete successfully till here but now I have to add a new feature to this i.e a web service API for the webmasters.
Without the user installing the script through a browser plugin, I want to provide the webmasters with a webservice API through which they can make this toolbar appear at the bottom of the page in their webistes. I came across a website http://www.iecustomizer.com/. Notice a small toolbar type thing appearing at the lower right corner of the website providing social bookmarks, etc.
I have to something similar using the above logic but I have never worked with web service. Please give me an idea so that I can keep treading.
The server from where these form.html etc. is downloadeded is an ASP.NET web server. It produces a JSON when a user clicks on an option on the toolbar and this 开发者_StackOverflow中文版JSON shows what options are to be loaded and what jQuery files are to be sent to the user.
In short, what you want to do is to have a toolbar created by you to be floating on all site pages and the toolbar will be served from a different (your) web-site.
There are two ways - one is to insert your code/script at client (browser) side and second is to insert it at server side. The second way would essentially means that every site page should have some stub/script that will load your tool bar. This can be either done by page authors or website administrators. For the later group, what you need is not a web service API but rather web server extension that would modify the response to include the stub. Typically, on IIS, you can have ISAPI Filter that will do this job - what is needed is that for every outgoing response of content type html, a link to a script needs to added to the html. The script file will be provided by you and hosted on the same server by website administrator. This script would create an iframe and load your tool-bar from your site.
精彩评论