(aboutMe)

I'm a hack, but a pretty good one... as hacks go, that is...

(network)

(search)


« (Internet Explorer 7 Favicon Display Problem) // (home)

Cross Browser Bookmark Script

by: havascript.com admin // November 16, 2007   ( ) {

Need: A cross browser bookmark script.

Problem: IE 7’s handling of the window.external object and the errors that result from using it. Most cross browser scripts that I’ve come across utilize this object within and I find the resulting client side error unacceptable.

My cobbled solution:
<a href=”#” rel=”sidebar” onclick=”if(document.all && !window.opera){ alert(’Havascript.com\n\n Thanks for attempting to bookmark us…\n …but you have to do it the old fashion, manual way in IE.’); return false; }else{ this.title = document.title; }” onMouseover=”window.status=’Bookmark Havascript.com’;return true” onMouseout=”window.status=”;return true” title=”Bookmark Havascript.com”>Bookmark!</a>

Live example:
Bookmark!

Behaviors:
Firefox: Initiates bookmark console
Opera: Initiates bookmark console
IE7: Initiates Alert box explaining that bookmarking must be done manually, but at least there is no error and it establishes the process in the visitors mind most probably resulting in a bookmark.

Notes:
- This is one single line of code and may be placed inline any existing HTML document.
- The onMousever events as well as the title attribute may be omitted to shorten the script if desired.
- The “\n” markup in the alert object are line breaks. “\n\n” is a double line break.

Should anyone have a better solution, please post.



topics: HTML, Javascript //
}

Comments

You must be logged in to post a comment.