Essentials of Javascript - Cultural View

Essentials of Javascript - Cultural View Essentials of Javascript - Cultural View

culturalview.com
from culturalview.com More from this publisher
14.07.2013 Views

Bookmarklet 61 History Steve Kangas of bookmarklets.com coined the term "bookmarklet", [1] which he started to create based on an idea suggested in the Netscape JavaScript Guide. The term favelet was used early on by Tantek Çelik on 6 September 2001 (personal email). Brendan Eich, who developed JavaScript at Netscape, gave this account of the origin of bookmarklets: They were a deliberate feature in this sense: I invented the javascript: URL along with JavaScript in 1995, and intended that javascript: URLs could be used as any other kind of URL, including being bookmark-able. In particular, I made it possible to generate a new document by loading, e.g. javascript:'hello, world', but also (key for bookmarklets) to run arbitrary script against the DOM of the current document, e.g. javascript:alert(document.links[0].href). The difference is that the latter kind of URL uses an expression that evaluates to the undefined type in JS. I added the void operator to JS before Netscape 2 shipped to make it easy to discard any non-undefined value in a javascript: URL. —Brendan Eich, email to Simon Willison [2] Example This example bookmarklet performs a Wikipedia search on any highlighted text in the web browser window. In normal use, the following Javascript would be installed to a bookmark in a browser [3] bookmarks toolbar. From then on, after selecting any text, clicking the bookmarklet performs the search. UNIQ-source-4-0cf60905ada3d8e1-QINU See also • Greasemonkey • iMacros • Ubiquity (Firefox) External links • Marklets.com - Bookmarklet Directory [4] - The largest most up to date collection of bookmarklets. • Jesse's Bookmarklets Site [5] - One of the earliest but now mostly outdated collections. • Bookmarklets Boost Web Surfing [6] , PC Magazine [7] , Tara Calishain, 4 March 2004. Retrieved 31 August 2007. • How to Use Is.Gd/Tiny Url/Bookmarklet-X in Chrome [8] - Effective method for bookmarklets in Google Chrome, 1 June 2009. Retrieved 18 July 2009 • WikiReader – bookmarklet for Wikipedia reading [9] • Dottoro.com Client-Side JavaScript [10] – Good site for developers, with many cross-browser problem solutions.

Bookmarklet 62 References [1] Domain bookmarklets.com (http://www.bookmarklets.com) registered 9 April 1998 [2] Willison, Simon (April 10th, 2004). "Email from Brendan Eich" (http://www.sitepoint.com/blogs/2004/04/09/bookmarklets/ #comment-3424). SitePoint. . Retrieved 22 April 2007. [3] Tested on Mozilla Firefox, Opera, Safari, and Chrome. Does not work in IE7 or IE8. Original source: Alex Boldt (http://math-www. uni-paderborn.de/~axel/bookmarklet.html) [4] http://www.marklets.com/bookmarklets/ [5] https://www.squarefree.com/bookmarklets/ [6] http://www.pcmag.com/print_article2/0,1217,a=116252,00.asp [7] http://pcmag.com [8] http://jonathan.dickinsons.co.za/blog/2009/06/how-to-use-isgdtiny-urlbookmarklet-x-in-chrome/ [9] http://www.vcarrer.com/2010/02/wikireader-bookmarklet-for-wikipedia.html [10] http://help.dottoro.com/ljswgnnf.php Client-side JavaScript Client-side JavaScript (CSJS) is JavaScript that runs on the client-side. While JavaScript was originally created to run this way, the term was coined because the language is no longer limited to just client-side, for example, server-side JavaScript (SSJS) is now available. Environment The most common Internet media type attribute for JavaScript source code is text/javascript, which follows HTML 4.01 and HTML 5 specifications and is supported by all major browsers. In 2006, application/javascript was also registered, though Internet Explorer versions 6 through 8 does not recognize scripts with this attribute. When no type attribute is specified in a script tag, the type value is by default "text/javascript" per HTML 5 specification. To embed JavaScript code in an HTML document, it must be preceded with the tag and followed with (possible attribute options omitted). Older browsers typically require JavaScript to begin with: The comment markup is required in order to ensure that the code is not rendered as text by very old browsers which do not recognize the tag in HTML documents (although script-tags contained within the head-tag will never be rendered, thus the comment markup is not always necessary), and the LANGUAGE attribute is a deprecated HTML attribute which may be required for old browsers. However, tags in XHTML/XML documents will not work if commented out, as conformant XHTML/XML parsers ignore comments and also may encounter problems with --, < and > signs in scripts (for example, the integer decrement operator and the comparison operators). XHTML documents should therefore have scripts included as XML CDATA sections, by preceding them with //

Bookmarklet 61<br />

History<br />

Steve Kangas <strong>of</strong> bookmarklets.com coined the term "bookmarklet", [1] which he started to create based on an idea<br />

suggested in the Netscape JavaScript Guide. The term favelet was used early on by Tantek Çelik on 6 September<br />

2001 (personal email). Brendan Eich, who developed JavaScript at Netscape, gave this account <strong>of</strong> the origin <strong>of</strong><br />

bookmarklets:<br />

They were a deliberate feature in this sense: I invented the javascript: URL along with JavaScript in 1995, and<br />

intended that javascript: URLs could be used as any other kind <strong>of</strong> URL, including being bookmark-able.<br />

In particular, I made it possible to generate a new document by loading, e.g. javascript:'hello, world', but also<br />

(key for bookmarklets) to run arbitrary script against the DOM <strong>of</strong> the current document, e.g.<br />

javascript:alert(document.links[0].href). The difference is that the latter kind <strong>of</strong> URL uses an expression that<br />

evaluates to the undefined type in JS. I added the void operator to JS before Netscape 2 shipped to make it<br />

easy to discard any non-undefined value in a javascript: URL.<br />

—Brendan Eich, email to Simon Willison [2]<br />

Example<br />

This example bookmarklet performs a Wikipedia search on any highlighted text in the web browser window. In<br />

normal use, the following <strong>Javascript</strong> would be installed to a bookmark in a browser [3] bookmarks toolbar. From then<br />

on, after selecting any text, clicking the bookmarklet performs the search.<br />

UNIQ-source-4-0cf60905ada3d8e1-QINU<br />

See also<br />

• Greasemonkey<br />

• iMacros<br />

• Ubiquity (Firefox)<br />

External links<br />

• Marklets.com - Bookmarklet Directory [4] - The largest most up to date collection <strong>of</strong> bookmarklets.<br />

• Jesse's Bookmarklets Site [5] - One <strong>of</strong> the earliest but now mostly outdated collections.<br />

• Bookmarklets Boost Web Surfing [6] , PC Magazine [7] , Tara Calishain, 4 March 2004. Retrieved 31 August 2007.<br />

• How to Use Is.Gd/Tiny Url/Bookmarklet-X in Chrome [8] - Effective method for bookmarklets in Google<br />

Chrome, 1 June 2009. Retrieved 18 July 2009<br />

• WikiReader – bookmarklet for Wikipedia reading [9]<br />

• Dottoro.com Client-Side JavaScript [10] – Good site for developers, with many cross-browser problem solutions.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!