You’ve often seen http: or ftp: at the beginning of a URL. This is the protocol: it tells the browser which protocol handler to use to retrieve the object referred to after the colon. The javascript: protocol is really no different; it simply instructs the browser to let JavaScript retrieve the object.
But rather than initiate communication with another server, the JavaScript handler returns the value of the variable or function cited after the colon. The value returned should be HTML or some other MIME type the browser knows how to display.
Leave a Reply
You must be logged in to post a comment.