How to see the hidden formats that get copied when copying HTML content?

nachocab

Is there a way to copy styled HTML and get the associated format that Chrome sees? For example, if I copy the title of this question, I paste it into the text editor that my newsletter provider (MailChimp) gives me, and I switch to HTML mode, I can see that what actually gets copied is:

<h1 itemprop="name" style="margin: 0px 0px 7px; padding: 0px; border: 0px; font-size: 23.3333339691162px; vertical-align: baseline; font-family: 'Trebuchet MS', 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 1.3; background: rgb(255, 255, 255);">
    <a href="http://stackoverflow.com/questions/24907135/error-cannot-read-property-of-undefined" class="question-hyperlink" style="margin: 0px; padding: 0px; border: 0px; font-size: 23.3333339691162px; vertical-align: baseline; color: rgb(0, 0, 0); text-decoration: none; cursor: pointer; background: transparent;">
        How to see the hidden formats that get copied when copying HTML content?
    </a>
</h1>

Is there an easy way to extract this information using a dedicated tool (not my newsletter provider)?

EDIT: Just to make it clear, if I inspect the title header and I click on Copy, I get the HTML without the embedded CSS:

<h1 itemprop="name">
    <a href="/questions/24907376/how-to-see-the-hidden-formats-that-get-copied-when-copying-html-content" class="question-hyperlink">How to see the hidden formats that get copied when  copying HTML content?
    </a>
</h1>
Niels Keurentjes

What you are trying to do is export standalone HTML. Your question is not entirely clear, but I'm assuming you're trying to retrieve it from a page under your control, and you can thus run Javascript.

This means that, at runtime, you need to determine the effective 'computed' styles for every element, and apply them to the element itself. After that you can simply read and process the innerHTML of the containing element to retrieve your standalone content.

Read the excellent answers on this question to see how to retrieve the runtime calculated style of every element. Then apply each of them explicitly to the element itself through its style property. The innerHTML property will reflect these changes in the returned value.

If the webpage you're trying to do this on is not under your control, you could always inject the same code using for example GreaseMonkey for Firefox or TamperMonkey for Chrome. This would make it enough of a 'universal tool'.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to preserve the page height when the content is hidden?

From Dev

How to get sysdate with different formats?

From Dev

Html and Internet Explorer: How to avoid hidden elements to be copied/pasted

From Dev

How to prevent ActionBar items get hidden when Navigation Drawer opens?

From Dev

Blocked when trying to get the content of HTML

From Dev

How can I get Selenium Web Driver to see drop downs that are "hidden"?

From Dev

How to get the html content from UIWebView?

From Dev

How to see the "hidden" python built-in?

From Dev

How to get a hidden content to show over cursor using html, css, javascript?

From Dev

How to show hidden content when hover in CSS not working

From Dev

how to get content of an element with HTML nodes?

From Dev

How to prevent part of HTML text from being copied when copying adjacent?

From Dev

How to get all html content of the clicked control?

From Dev

How to get notified when user copied something in android?

From Dev

Links in footer unclickable (bottom-fixed and behind content) when overflow-x is hidden for html and body

From Dev

How to programmatically get the HTML that the Devtools see when clicking on line number?

From Dev

How to programmatically get the HTML that the Devtools see when clicking on line number?

From Dev

How to get an iframe to show when hidden?

From Dev

Content Negotiation when looking at different output formats

From Dev

How do I see where a folder was copied from?

From Dev

How to see hidden audio files in audio CDs

From Dev

How to get sysdate with different formats?

From Dev

how to get html hidden value in behind code?

From Dev

How to prevent ActionBar items get hidden when Navigation Drawer opens?

From Dev

html - Hidden content in div tag

From Dev

Blocked when trying to get the content of HTML

From Dev

How to get a hidden content to show over cursor using html, css, javascript?

From Dev

How to prevent part of HTML text from being copied when copying adjacent?

From Dev

How to get part of a forumla to increase when copied?

Related Related

  1. 1

    How to preserve the page height when the content is hidden?

  2. 2

    How to get sysdate with different formats?

  3. 3

    Html and Internet Explorer: How to avoid hidden elements to be copied/pasted

  4. 4

    How to prevent ActionBar items get hidden when Navigation Drawer opens?

  5. 5

    Blocked when trying to get the content of HTML

  6. 6

    How can I get Selenium Web Driver to see drop downs that are "hidden"?

  7. 7

    How to get the html content from UIWebView?

  8. 8

    How to see the "hidden" python built-in?

  9. 9

    How to get a hidden content to show over cursor using html, css, javascript?

  10. 10

    How to show hidden content when hover in CSS not working

  11. 11

    how to get content of an element with HTML nodes?

  12. 12

    How to prevent part of HTML text from being copied when copying adjacent?

  13. 13

    How to get all html content of the clicked control?

  14. 14

    How to get notified when user copied something in android?

  15. 15

    Links in footer unclickable (bottom-fixed and behind content) when overflow-x is hidden for html and body

  16. 16

    How to programmatically get the HTML that the Devtools see when clicking on line number?

  17. 17

    How to programmatically get the HTML that the Devtools see when clicking on line number?

  18. 18

    How to get an iframe to show when hidden?

  19. 19

    Content Negotiation when looking at different output formats

  20. 20

    How do I see where a folder was copied from?

  21. 21

    How to see hidden audio files in audio CDs

  22. 22

    How to get sysdate with different formats?

  23. 23

    how to get html hidden value in behind code?

  24. 24

    How to prevent ActionBar items get hidden when Navigation Drawer opens?

  25. 25

    html - Hidden content in div tag

  26. 26

    Blocked when trying to get the content of HTML

  27. 27

    How to get a hidden content to show over cursor using html, css, javascript?

  28. 28

    How to prevent part of HTML text from being copied when copying adjacent?

  29. 29

    How to get part of a forumla to increase when copied?

HotTag

Archive