JS browser menu commands

Source: Internet
Author: User
Use JavaScript Code Implement browser menu commands (the following code is successfully debugged in a Windows XP browser ).

1. Implementation of the open command

[Format]: document.exe ccommand ("open ")
[Note] This is similar to the webbrowser control commands in programming design such as VB. You can also consider it here.
[Example] Add the following content between <body> </body>:
<A href = "#" onclickappsdocument.exe ccommand ("open")> open </a>

2. Implementation of the command 'use notepad edit'

[Format]: location. Replace ("view-source:" + location)
[Note] Open notepad and showSource code.
[Example] Add the following content between <body> </body>:
<A href = "#" onclick = location. Replace ("view-source:" + location)> edit with notepad </a>

3. Implementation of the "Save as" command

[Format]: document.exe ccommand ("saveas ")
[Note] Save the webpage to another directory on the local disk!
[Example] Add the following content between <body> </body>:
<A href = "#" onclickappsdocument.exe ccommand ("saveas")> Save As </a>

4. Implementation of the *** print *** command

[Format]: document.exe ccommand ("print ")
[Note] Of course, you must have installed a printer!
[Example] Add the following content between <body> </body>:
<A href = "#" onclickappsdocument.exe ccommand ("print")> Print </a>

5. Implementation of the "close" command

[Format]: window. Close (); Return false
[Note] This window will be closed.
[Example] Add the following content between <body> </body>:
<A href = "#" onclick = Window. Close (); Return false)> close this window </a>

Implementation of the command
[Format]: document.exe ccommand ("selectall ")
[Description] All content on the webpage will be selected!
[Example] Add the following content between <body> </body>:
<A href = "#" onclickappsdocument.exe ccommand ("selectall")> select all </a>

6. Implementation of the command for source file

[Format]: location. Replace ("view-source:" + location)
[Description] view the source code of the webpage.
[Example] Add the following content between <body> </body>:
<A href = "#" onclick = location. Replace ("view-source:" + location)> View source files </a>

7. Implementation of the "add to Favorites" command

[Format]: window. External. AddFavorite ('url', 'site name ")
[Description] add this page to favorites.
[Example] Add the following content between <body> </body>:
<A href = "javascript: window. External. AddFavorite ('HTTP: // oh.jilinfarm.com ', 'huming new homepage')"> Add to favorites </a>

8. Implementation of the "Sort favorites" command

[Format]: window. External. showbrowserui ("organizefavorites", null)
[Description] The "Sort favorites" dialog box is displayed.
[Example] Add the following content between <body> </body>:
<A href = "#" onclick = Window. External. showbrowserui ("organizefavorites", null)> sort favorites </a>

9. Implementation of the "Internet Options" command

[Format]: window. External. showbrowserui ("privacysettings", null)
[Description] the "Internet Options" dialog box is displayed.
[Example] Add the following content between <body> </body>:
<A href = "#" onclick = Window. External. showbrowserui ("privacysettings", null)> Internet Options </a>

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.