preserving html tags in a selection w/Safari

Discussion in 'Javascript' started by Nick, Feb 15, 2004.

  1. Nick

    Nick Guest

    I'm trying to teach myself a little javascript on the mac, and in the
    course of doing so, I decided to try to create a bookmarklet to open a
    selected area of text in a new window (Using Safari 1.0.1). This is
    easy enough to accomplish, but I'd like to preserve the html markup
    of the selected text. To my knowledge, createRange() doesn't work with
    Safari, and I can't think of a way to do it. Here's what I have;

    javascript:eek:utText=getSelection();if(!outText){void(0)};if(outText){newwindow=window.open('','selectionWindow','width=800,height=600');newwindow.document.write('<body>'+outText+'</body>');newwindow.document.close()}

    Is there a means of replacing getSelection() with something that will
    preserve the html tags within the selection??

    Thanks in advance!
    Nick, Feb 15, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dean H. Saxe
    Replies:
    0
    Views:
    1,027
    Dean H. Saxe
    Jan 3, 2004
  2. Joe
    Replies:
    2
    Views:
    500
  3. TTroy
    Replies:
    16
    Views:
    788
    Peter Nilsson
    Jan 31, 2005
  4. Replies:
    4
    Views:
    520
  5. bala2008
    Replies:
    0
    Views:
    646
    bala2008
    Jun 27, 2008
Loading...

Share This Page