Hi,
I have a bookmarklet that works perfectly in Firefox, IE, Konqueror,
and Opera, but in Safari 2.0.3 (417.9.2) it doesn't work. I enabled
debugging and I can see "TypeError - Undefined value" reported in the
Javascript console, but I'm not sure where the error is.
The bookmarklet in question is here:
javascript:if (parseInt(navig ator.appVersion ) >= 4) { if
(navigator.user Agent.indexOf(' MSIE') 0) { q =
document.select ion.createRange ().text; } else if
(navigator.user Agent.indexOf(' Safari') 0) { q =
document.select ion.createRange ().text; } else { q =
document.getSel ection(); } if (!q) { void(q = prompt('Enter
keywords to search your Simpy Links:', '')); } if (q) {
location.href=' http://www.simpy.com/simpy/LinkSearch.do?q =' +
encodeURICompon ent(q); }}
I tried changing the "document.selec tion.createRang e().text" bit in the
case of Safari to "document.getSe lection()", but that didn't work
either, the error being "TypeError - Value undefined (result of
expression document.getSel ection) is not object".
Does anyone know how to get the selected text under Safari?
If anyone's interested, this bookmarklet is from Simpy -
http://www.simpy.com/simpy/BrowserBookmarklets.do
Any help would be very appreciated. Thank you!