Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Workaround for a Safari 1.3 getSelection() problem' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Workaround for a Safari 1.3 getSelection() problem
Authored by: joemaller on Apr 26, '05 03:56:41PM
I also posted a getSelection() workaround a few days ago. It's not really an AppleScript problem, rather a change in how Safari and Firefox handle the getSelection() function.

The gist is that Safari and Firefox both implemented security based changes to getSelection in their latest releases. Safari's update includes a bug which affects any string functions on the returned value of getSelection(). There are a few ways around this which work with older browser versions. The simplest is simply to add an empty string to the value (plus quote quote):

tell application "Safari"
  do JavaScript "getSelection()+''" in document 1
end tell
That immediately forces the getSelection() result into a string. From there everything should work normally.

Follow the link if you want more information.

[ Reply to This | # ]