"Encrypted" html code for google search?
When I view the page source of google search, for example http://www.google.com/search?q=test,
the html code looks messy and I can't understand a thing from it (see below).Is it on purpose?
What is this "encryption" called and how do I create it for normal html?Thanks!
function _tvn(a,b){var c=parseInt(a,10);
return isNaN(c)?b:c}function _tvf(a,b){var c=parseFloat(a);
return isNaN(c)?b:c}function _tvb(a,b)开发者_开发问答{return a=="true"?e:a=="false"?k:b}function _tvv(a)
{return!!a}function n(a,b,c){(c||m) aa=function(){return m.bv.m==1};n("sb",aa);
The HTML isn't encrypted, it's just minified, or in fact, its just the JS that is minified. The HTML is there, in normal format, just need to look for it in the right place. Direct copy of the html from that page, from the source code.
This is not HTML, it's javascript. And it's not "Encrypted", it's compressed (minified), they change all the function names to be as short as possible, all the variable names to be as short as possible, and just compress it as much as possible by removing lines spaces and everything that is not useful... There are many internet applications and methods to do that...
It's done to reduce the page size and to reduce loading time... there are many applications that reverse that compression...
Google has a library called Closure Compiler that it uses to optimize ("minify") JavaScript. This has the side effect of making it difficult to read ("obfuscated") and to copy. The library is free, so you can use it with your code, and alternatives are also available (see the other answers).
Google run their JS through an optimiser to increase speed of download and execution.
The JavaScript has been compressed and obfuscated, which makes it difficult to read and understand, while decreasing the file size to optimise loading times.
If you'd like to do something similar with your JavaScript have a look at YUI Compressor.
jsbeautifier at http://jsbeautifier.org can unminify, unpack, and unobfuscate.
精彩评论