Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery html() is decoding html entities by default?

I dont know why on earth jquery html() is doing this, but after i do

$('html').html()

i get "&copy" automatically converted to ©

anyway to avoid this? I need to dump the html of the page using javascript and dont need this useless conversions that are screwing up the html.

like image 832
Ricardo Avatar asked Mar 15 '26 06:03

Ricardo


1 Answers

This really isn't the jQuery, or even JavaScript for that matter.

The browser will hold its own normalised representation of the underlying DOM. It will bear a close resemblence the the document itself, but character decoding (like the above) will be preserved.

Have a read of the following:

http://www.brainjar.com/dhtml/intro/

http://bytes.com/topic/javascript/answers/146257-body-innerhtml-issue

I'm afraid there is no way around this as far as I am aware.

like image 90
James Wiseman Avatar answered Mar 17 '26 19:03

James Wiseman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!