JS achieving the browser back and forward part of the native refresh functions

Whenever we see someone else on the page to open, print, forward, save as, back, close this window, disable the right-browser commands such as to achieve the link, while he suffered from failing, is not very much regret? Is not also want to achieve? If we can achieve on the web browser, the command, it will be interesting how things ah! Here we take a look at how to use Javascript code to achieve your browser menu commands (the following code in the browser under Windows XP via debug).

1, [File (F)] menu commands to achieve

1, [] order to achieve open

[Format]: document.execCommand ( "open")
[Note] This and other Programming with VB in the webbrowser control is somewhat similar to the command, we can so pondering pondering.
[For example] In <body> </ body> inserted between:
<a href="#""open")> Open </ a>

2] [use Notepad to edit the realization of the command

[Format]: location.replace ( "view-source:" + location)
[Note] to open Notepad, in Notepad to display the page's source code.
[For example] In <body> </ body> inserted between:
<a href="#""view-source:"+location)> use Notepad to edit </ a>

3] [the Save As command to achieve

[Format]: document.execCommand ( "saveAs")
[Note] this page is saved to a local disk to other directories!
[For example] In <body> </ body> inserted between:
<a href="#""saveAs")> Save As </ a>

4, [ Print ] order to achieve

[Format]: document.execCommand ( "print")
[Note] Of course, you have to install a printer!
[For example] In <body> </ body> inserted between:
<a href="#""print")> print </ a>

5, [Close] order to achieve

[Format]: window.close (); return false
[Note] will close the window.
[For example] In <body> </ body> inserted between:
<a href = "#" Close this window </ a>

2, [Edit (E)] menu commands to achieve

Select] [order to achieve [format]: document.execCommand ( "selectAll")
[Note] to selection page, the entire contents!
[For example] In <body> </ body> inserted between:
<a href="#""selectAll")> Select All </ a>

3, [View (V)] menu commands to achieve

1] [Refresh command to achieve

[Format]: location.reload () or history.go (0)
[Note] re-open the browser page.
[For example] In <body> </ body> inserted between:
<a href = "#" Refresh </ a>
Or acceded to: <a href = "#" Refresh </ a>

2, the source file] [order to achieve

[Format]: location.replace ( "view-source:" + location)
[Note] to view the page source code.
[For example] In <body> </ body> inserted between:
<a href="#""view-source:"+location)> View Source </ a>

3, [] order to achieve full-screen display

[Format]: window.open (document.location, "url", "fullscreen")
[Note] full screen page.
[For example] In <body> </ body> inserted between:
<a href="#""url","fullscreen")> full screen </ a>

4, [Collection (A)] menu commands to achieve

1 Add to Favorites] [order to achieve

[Format]: window.external.AddFavorite ( 'url', ' "site name")
[Note] to this page Add to Favorites.
[For example] In <body> </ body> inserted between:
<a href="javascript:window.external.AddFavorite('http://oh.jilinfarm.com',' Hu revised personal home page ')"> Add to Favorites </ a>

2, Organize Favorites] [order to achieve

[Format]: window.external.showBrowserUI ( "OrganizeFavorites", null)
[Note] open the Organize Favorites dialog box.
[For example] In <body> </ body> inserted between:
<a href="#""OrganizeFavorites",null)> Organize Favorites </ a>

5, [Tool (T)] menu commands to achieve

Internet options] [order to achieve

[Format]: window.external.showBrowserUI ( "PrivacySettings", null)
[Note] open internet Options dialog box.
[For example] In <body> </ body> inserted between:
<a href="#""PrivacySettings",null)> internet options </ a>

6, [] toolbar in order to achieve

1, [] order to achieve progress

[Format] history.go (1) or history.forward ()
[Note] browser opens a page.
[For example] In <body> </ body> inserted between:
<a href = "#" advance </ a>
Or acceded to: <a href = "#" advance </ a>

2, [Back] order to achieve

[Format]: history.go (-1) or history.back ()
[Note] browser, return to the previous page has been viewed.
[For example] In <body> </ body> inserted between:
<a href = "#" Back </ a>
Or acceded to: <a href = "#" Back </ a>

3 Refresh] [order to achieve

[Format]: document.reload () or history.go (0)
[Note] re-open the browser page.
[For example] In <body> </ body> inserted between:
<a href = "#" Refresh </ a>
Or acceded to: <a href = "#" Refresh </ a>

7, the other commands to achieve

Close the window] [Order from time to time the realization of [format]: settimeout (window.close (), closing time)
[Note] will close the window.
[For example] In <body> </ body> inserted between:
<a href = "#" s close this window </ a>

分类:Web 时间:2009-11-05 人气:294
分享到:
blog comments powered by Disqus

相关文章

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.376 (s). 12 q(s)