views:

832

answers:

2

If I drag and drop a selection of a webpage from Firefox to HTML-Kit, HTML-Kit asks me whether I want to paste as text or HTML. If I select "text," I get this:

Version:0.9
StartHTML:00000147
EndHTML:00000516
StartFragment:00000181
EndFragment:00000480
SourceURL:http://en.wikipedia.org/wiki/Herodotus
<html><body>
<!--StartFragment-->Additional details have been garnered from the <i><a href="http://en.wikipedia.org/wiki/Suda" title="Suda">Suda</a></i>, an 11th-century encyclopaedia of the <a href="http://en.wikipedia.org/wiki/Byzantium" title="Byzantium">Byzantium</a> which likely took its information from traditional accounts.<!--EndFragment-->
</body>
</html>

According to MSDN, this is "CF_HTML" formatted clipboard data. Is it the same on OS X and Linux systems?

Is there any way to access this kind of detailed information (as opposed to just the plain clip fragment) in a webpage-to-webpage drag and drop operation? What about to a C# WinForms desktop application?

+1  A: 

It is Microsoft specific, don't expect to see the same information in other OSes.
Note that you get the same format when you copy a fragment from IE.

I am not sure what you mean by "webpage-to-webpage drag and drop operation". To drop where? A textarea?

I don't know C#, but in C/C++ applications, you have to use OpenClipboard and related Win32 APIs to get this info. In particular, GetClipboardData(CF_HTML) allows you to get this info (can be obtained in plain text too, for example, or Unicode data, etc.).

PhiLho
By webpage to webpage, I mean a dragging text from one page to another, into a text box or text area. Ideally, what I'd like to do is access the SourceURL property and find out where the data came from.
amdfan
+1  A: 

A WinForms app can use Clipboard.GetText to get it. I don't think there is a way to do it in a webpage, however.

Mark Brackett