Lavandysh
Lavandysh

Reputation: 571

How do I pass url parameters within url parameters

I want to show a pdf using google viewer like this:

https://drive.google.com/viewerng/viewer?embedded=true&url=http://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf

But my page should be opened with parameters like this:

https://mywebsite.com/pdfgenerator.xhtml?parameter1=true&parameter2=false

(On this page a pdf is generated, and that is not a valid website)

That means that I should pass parameters within the url parameter of the first page, but then they get interpreted as the parameters for the first page.

https://drive.google.com/viewerng/viewer?embedded=true&url=https://mywebsite.com/pdfgenerator.xhtml?parameter1=true&parameter2=false

How do I solve this problem? How do I pass a parameter within a parameter? I can't find any information about it.

Thank you for your help.

Upvotes: 0

Views: 111

Answers (1)

Lavandysh
Lavandysh

Reputation: 571

It's solved: If you encode it using encodeURIComponent and then pass it as the parameter it works. If you need to do it quickly you can use this TryIt from W3Schools. Adjust the address, click run and click the button, then copy the link.

Upvotes: 1

Related Questions