http - How does Google redirect its search results? -


i input query java search text box on https://www.google.com. 1 result https://en.wikipedia.org/wiki/java_(programming_language). following text right clicking link , selecting copy link address.

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=10&cad=rja&uact=8&ved=0ahukewiijvlpqvnsahvfqy8khu5udyyqfghdmak&url=%68%74%74%70%73%3a%2f%2f%65%6e%2e%77%69%6b%69%70%65%64%69%61%2e%6f%72%67%2f%77%69%6b%69%2f%4a%61%76%61%5f%28%70%72%6f%67%72%61%6d%6d%69%6e%67%5f%6c%61%6e%67%75%61%67%65%29&usg=afqjcneamdpwkk-lszs-jjsyrwukedrmka&bvm=bv.150729734,d.dgc

and paste above link chrome address bar. , use developer tools monitor http network traffic.

enter image description here

the first http request original link. , status code 200. how chrome make following request https://en.wikipedia.org/wiki/java_(programming_language)?i know http response status code 302 can make brsowers following link in location header. how redirect done in case status code 200?

the redirect done because in response of first http request (https://www.google.com/url?sa=t&rct=j...):

  • if javascript enabled, window location navigated https://en.wikipedia.org/... using script.
  • if javascript disabled, or client not support javascript, <meta http-equiv="refresh"> used redirect https://en.wikipedia.org/...

here response body of first http request:

<script>window.googlejavascriptredirect=1</script> <meta name="referrer" content="origin"> <script>var n={navigateto:function(b,a,d){if(b!=a&&b.google){if(b.google.r){b.google.r=0;b.location.href=d;a.location.replace("about:blank");}}else{a.location.replace(d);}}};n.navigateto(window.parent,window,"https://en.wikipedia.org/wiki/java_(programming_language)"); </script> <noscript> <meta http-equiv="refresh" content="0;url='https://en.wikipedia.org/wiki/java_(programming_language)'"> </noscript> 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -