• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Selected string in WebView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Selected string in WebView


  • Subject: RE: Selected string in WebView
  • From: "Christopher Hickman" <email@hidden>
  • Date: Tue, 23 May 2006 10:34:13 -0400

> Hi!
> Is there a method to get the selected text inside a WebView.
> I've found
>
> [[myWebView selectedDOMRange] markupString];
>
> but it return the complete page range html source. I would
> only the text.

Does -[DOMRange toString] give you what you want?

There's little to no documentation to explain the interface of the DOM
classes, but take a look at the header to see the messages you can send a
DOMRange object here:
http://www.opensource.apple.com/darwinsource/Current/WebCore-417.24/kwq/DOMR
ange.h

Note that there are some un-Cocoa-like names for some of these methods,
since it is just a wrapper for the W3C DOM IDL (as explained here:
http://developer.apple.com/documentation/Cocoa/Conceptual/DisplayWebContent/
Tasks/DOMObjCBindings.html).

Topher

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Selected string in WebView (From: malcom <email@hidden>)

  • Prev by Date: how do i force NSArrayController to sort?
  • Next by Date: Re: Bug in PDFKit's PDFDocument attributes?!
  • Previous by thread: Selected string in WebView
  • Next by thread: NSTokenField - token menu problem
  • Index(es):
    • Date
    • Thread