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. 
and paste above link chrome address bar. , use developer tools monitor http network traffic. 
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 redirecthttps://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
Post a Comment