开发者

What are the algorithms used to convert HTTP content to TEXT in clipboard?

开发者 https://www.devze.com 2023-02-14 05:50 出处:网络
I noticed that if you copy-paste web browser content into Notepad (or any text editor), you get different results, depending on the browser used.

I noticed that if you copy-paste web browser content into Notepad (or any text editor), you get different results, depending on the browser used.

That is, if you try the开发者_Python百科 following:

  1. Ctrl-A (while inside IE, Firefox, Chrome, etc.)
  2. Ctrl-C
  3. Ctrl-V (inside Notepad)

You will see that the text content from Internet Explorer is different than the one from Firefox.

(I conducted this test on Windows XP and Windows 7)

Why is that?

Are web browsers free to use any algorithm they choose to convert HTML content to CF_TEXT?

If so, are there any "minimal rules" they must adhere to?


When you copy data from the browser, the browser is responsible for converting data into the various clipboard formats. Since all of these data conversions can be expensive, most browsers will defer the conversion until a call is made to retrieve the clipboard data. According to MSDN, this is accomplished by calling SetClipboardData with a NULL for the second parameter. When a later call is made to GetClipboardData, the browser receives a WM_RENDERFORMAT or WM_RENDERALLFORMATS message. It is at this point that the browser performs the conversion to text. There are no particular rules that the browser must follow when performing this conversion.

0

精彩评论

暂无评论...
验证码 换一张
取 消