|
A bookmarklet is a bookmark stored in a web browser that contains JavaScript commands that add new features to the browser. Bookmarklets are Unobtrusive JavaScripts stored as the URL of a bookmark in a web browser or as a hyperlink on a web page. Bookmarklets are usually JavaScript programs. Regardless of whether bookmarklet utilities are stored as bookmarks or hyperlinks, they add one-click functions to a browser or web page. When clicked, a bookmarklet performs one of a wide variety of operations, such as running a search query or extracting data from a table. For example, clicking on a bookmarklet after selecting text on a webpage could run an Internet search on the selected text and display a search engine results page. == Concept == Web browsers use URIs for the href attribute of the <a> tag and for bookmarks. The URI scheme, such as http: , file: , or ftp: , specifies the protocol and the format for the rest of the string. Browsers also implement a prefix javascript: that to a parser is just like any other URI. Internally, the browser sees that the specified protocol is ''javascript'', treats the rest of the string as a JavaScript application which is then executed, and uses the resulting string as the new page.The executing script has access to the current page, which it may inspect and change. If the script returns an undefined type (rather than, for example, a string), the browser will not load a new page, with the result that the script simply runs against the current page content. This permits changes such as in-place font size and color changes without a page reload. An anonymous function that does not return a value, define a function etc., can be used to force the script to return an undefined type: However, if a script includes a function definition/redefinition, such as function Use_this_globally() , the environment will not be populated with it. For this reason an should be suffixed with ;void(...); .抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「bookmarklet」の詳細全文を読む スポンサード リンク
|