Using JavaScript to develop IE browser local plug-in instance _javascript tips

Source: Internet
Author: User

The use of JS developed by IE Plug-ins can be in the current browsing page to execute JS code, on this basis to achieve any user can think of the function.
You can do some common processing for unused sites (such as extracting some sort of information), or you can do special processing for specific websites (like snapping up train tickets).

The implementation of this plug-in method is relatively simple, just copy a few files, modify a registry value. So it is more suitable for fast implementation of some browser or web accessibility features.

Implementation steps:

1. Create HTML files that implement specific functionality

Copy Code code as follows:

File name: getticketslist.html
File contents:
<script language= "JavaScript" >
var args = external.menuarguments;
var doc = args.document;
var cframe = doc. Contents_iframe;

if (cframe && cframe.document) {
Doc = cframe.document;//Gets the document element for the current page
TODO: Get the ticket list element from document and handle it accordingly
}
</script>


2. Create a registry file
Copy Code code as follows:

File name: Getticketslist.reg
File contents: The CLSID in the file can be modified arbitrarily, the only

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\extensions\{878ec0c9-aaad-4331-9b3a-2d8ba93aead2}]
"CLSID" = "{2fba04ee-3024-11d2-8f1f-0000f87abd16}"
"Default Visible" = "yes"
"Script" = "c:\\getticketslist.html"
"MenuText" = "Handle Tickets"


3. Copy the HTML file to the path specified in the reg file (such as c:\getticketslist.html)
4. Run Getticketslist.reg, modify the registration form
5. Restart IE, in the menu "tool" You can see just added the function "Processing tickets", click to perform

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.