Creating Links with Mozilla's window.getSelection() Method

Friday October 25th, 2002

Kenneth Dillon writes: "This morning, IBM developerWorks published a tutorial detailing how Mozilla's cutting-edge ECMAScript and W3C DOM support and its nonstandard, but incredibly useful window.getSelection() method can be put to work to allow users to create links to virtually any piece of text within an HTML document."

Note that you must have a developerWorks profile to access this tutorial. You can create a free profile at the registration page.

#11 Re: Why don't we add a simple example here?

by bugs4hj <>

Saturday October 26th, 2002 12:17 AM

You are replying to this message

Hm, that was not suppost to happen (:

1) Drag that link to the personal toolbar and drop it there

2) copy this snap

javascript:id=window.getSelection();if(!id){void(id=prompt('Select some text or enter it

3) right-click on that bookmark and select 'Properties'

4) past it over '<>' in the location text field

5) click Ok (you might also want to rename it to

Ok how does it work? 1) select some text on a webpage 2) click on that bookmark note: it should open a webpage on