Continue to write about antique bars.
Accelerator, the Chinese version is accelerator
It's also a fun thing for IE8.
For development documentation, see msdn
In fact, it is an XML document. Let's first try it out for a book search.
Add accelerator:
Select text:
Select accelerator:
Search results (cup, not even related ...) :
Let's take a look at the code.
To create an accelerator, you must create an XML file on the server. The Code is as follows:
<? XML version = "1.0" encoding = "UTF-8"?> <OS: openservicedescription xmlns: OS = "http://www.microsoft.com/schemas/openservicedescription/1.0"> <OS: homepageurl> http://library.ouc.edu.cn/</OS: homepageurl> <OS: Display> <OS: name> library search </OS: Name> <OS: icon> http://library.ouc.edu.cn/favicon.ico </OS: icon> <OS: Description> library search </OS: description> </OS: Display> <OS: activity category = ""> <OS: activityaction context = "selection"> <OS: Execute action = "H Ttp: // library.ouc.edu.cn/opac/search.aspx? "Method =" get "> <OS: parameter name =" Words "value =" {selection} "type =" text "/> </OS: Execute> </OS: activityaction> </OS: activity> </OS: openservicedescription>
Maybe you can see it.
It consists of three parts: homepageurl, display, and activity.
1, homepageurl
This is the home address of the accelerator service. Note that the link to the action in the activity must be in the domain specified by homepageurl, otherwise, an error will be reported when you register the accelerator.
2, display
This node is composed of three parts:
Name: name displayed by the accelerator
Icon: the name of the accelerator displayed in the browser
Discription: Introduction to Accelerators
3. Activity
This is the node for implementing the accelerator function.
Activity: this node sets the function category of the accelerator. IE8 has six categories by default: map blog define add translate share. Of course, you can also write them by yourself.
The default value of the context attribute of the node activityaction is selection, which is to select the reversed data.
Execute is the redirection address, and action is the address (note that it should be in the same domain as homepageurl). method can have get and post methods.
Parameter is the value-passing node. You can see more than one parameter, such as name, value, and type.
The last thing to say is to register the accelerator for the browser. The HTML code:
<Button onclick = "window. External. addservice ('HTTP: // library.ouc.edu.cn/search.xml')"> Add an accelerator </button>
That's all.
More comprehensive descriptions on msdn
For more information, see msdn.