On 08/10/2008, at 8:45 AM, Ömer Kardaş wrote:
This works better. However external CSS code is not copied, which
makes the page look different. When I select all and copy from the
webview manualy and then paste it on a new mail window it works
fine, the external CSS is copied as well. Is there any way I get the
full source (including the external CSS) so that I can place it on
the pasteboard?
In order to get the source of a WebView you'd do something like this:
DOMHTMLElement* el=(DOMHTMLElement*)[self
mainFrameDocument].documentElement;
NSString* source=el.outerHTML;
However, external CSS files are not part of the source of the page so
no method of obtaining just the source code will do this for you.
I suspect what is happening when you copy and paste into Mail is that
the WebView is placing a web archive on the clipboard, which contains
all the images and other linked resources.
You can get a web archive like this:
[[[webView mainFrame] dataSource] webArchive];
When copying to the clipboard you can specify the type as
WebArchivePboardType.
--
Rob Keniger
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]