www.webdeveloper.com
Results 1 to 2 of 2

Thread: How does Google hide results in javascript?

  1. #1
    Join Date
    Aug 2005
    Posts
    28

    How does Google hide results in javascript?

    How does Google hide results in javascript?

    I know that the content of a search engine is copyrighted. I am only interested in saving the results of a search in a more automated fashion for my own personal use.

    Now, years ago, when the internet was young, a friend of mine and I used to discuss how a web site could hide it source from the browser. Let me explain. In Internet Explorer, one can easily find out how a web site's HTML code looks like by just going to the menu and clicking View->Source (the menu is still there, by the way, just like in the old days, you just need to hit the ALT key).

    All of the source code, that is, all of the HTML code used to make a web page is right there for anyone to see. This is the spirit of the internet, as being all open and honest to the user. I guess they did this for anyone who was paranoid about subliminal advertising or hidden graphics so that THE MAN could not use is mind control... or whatever.

    Well Google, it seems, has managed to hide how their content from people who take a peek at the HTML of a search ressults page. It seems to be nested deeply in the JAVASCRIPT.

    So my question is this. Is there some why I can decode this with a little basic understanding of javascript, or is it lost forever?

    When I open a browser; go to google.com; search on "test string" I get my first page of results. Then if I click on the browser menu to save the source code as "data.html" and then open "data.html" inside the browser, it shows the google home page instead of the results page. How does google do this trick and how can I get the results page programatically.

  2. #2
    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    227
    When you save the page you only save the original html code and not whatever is inserted by JavaScript, as you might have guessed. How exactly Google does this is probably very complicated as it involves JavaScript fetching data dynamically from their servers after the page has loaded and inserting it into the page in different ways.

    Anyway, if you want to see and copy/save the altered html code and you're using Firefox you can use the Firebug add-on to do so. Or if you're using Google Chrome you can just hit F12 to see everything. I'm not sure how to do it in Internet Explorer.

    Edit: and just to clarify something - JavaScript is very commonly used to insert elements into the page after it has loaded, it's not just Google who does it. And the JavaScript code is just as visible as the html code, so they are not really hiding anything. :)
    Last edited by ReFreezed; 10-23-2012 at 10:37 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles