0
http://localhost:8000/pary/?url=https://jobs.chegg.com/#categoryName#-jobs&uid=OIKAHY&env_id=4

In my Django views for pary function, for the above url, when I am doing data = request.GET.get('url') I am getting data as https://jobs.chegg.com/ instead of https://jobs.chegg.com/#categoryName#-jobs

Its ignoring all the content after # keyword. Please suggest how to get the complete url parameter value in python.

Mahesh
  • 1,117
  • 2
  • 23
  • 42

1 Answers1

0

Perhaps this will help? Yes, it might only include the relative URL, but you can simply append the domain before it.

crimsonpython24
  • 2,223
  • 2
  • 11
  • 27
  • I dont need the domain, in the example you shared I want the parameter value for **print** which is **true** but it doesnt get that – Mahesh Jul 14 '20 at 11:28
  • The parameter `?print=true` is only a demo from the Django documentation and I can't see it anywhere in your code. All I meant is that this function in my answer returns the full url. – crimsonpython24 Jul 14 '20 at 11:37
  • yes, I mean when I tried with code, I got `http://localhost:8000/url/` What I mean in my previous comment is that I wanted the `true` as output from that example so that I will use the same in my code to get `https://jobs.chegg.com/#categoryName#-jobs` – Mahesh Jul 14 '20 at 11:39
  • 1
    From all I know, the `#` is a feature only limited in browsers. It's called an anchor and it only directs to a certain section on the web page, which won't be recognized by the browser. You might have to get the full URL in javascript [here](https://www.w3schools.com/jsref/prop_loc_hash.asp) and pass it back to the Django server as a string [here](https://stackoverflow.com/questions/27100825/how-pass-javascript-function-s-value-to-django-view). – crimsonpython24 Jul 14 '20 at 11:45
  • Got it, but unfortunately, I cannot pass it from JavaScript because its an `href` click in html page – Mahesh Jul 14 '20 at 11:48