1

I'm trying to extract the keywords from Google search engine through document.referrer. The full referrer URL becomes like this:

"https://www.google.com.pk/?gws_rd=cr&ei=LXxHVIb_JNC07Qae7oCwAg#q=stack+overflow"

The document.referrer property only gives me this:

"https://www.google.com.pk/?gws_rd=cr&ei=LXxHVIb_JNC07Qae7oCwAg"

Leaving out #q=stack+overflow, but I also want that part after the hash.

Any idea on how I can grab the full URL?

Marco Bonelli
  • 63,369
  • 21
  • 118
  • 128
  • 3
    see this http://stackoverflow.com/questions/2039306/send-a-location-hash-through-a-referrer – asdf_enel_hak Oct 22 '14 at 12:38
  • it explains about location.href which returns the url of the current page but i want the url of the referrer page which is google search engine in my case – azeem abbas Oct 22 '14 at 12:47
  • 1
    in [this answer](http://stackoverflow.com/a/2039410/492258) it says: `the hash portion of a URL is used on the client side only. It will never appear in server logs, requests, or as part of a REFERRER string.` – asdf_enel_hak Oct 22 '14 at 13:23
  • but when i try to extract it from $_SERVER['HTTP_REFERER'] in php it also gives the portion after # but not in document.referrer.But according to you it is not possible for javascript referrer to grab it – azeem abbas Oct 22 '14 at 13:33

0 Answers0