Mark
Mark

Reputation: 1400

HTML web link vs typed url difference

Can someone please help me understand why a linked clicked in PC browser (in my case FF) works. But when I paste the same URL into a new tab on the same browser I get a different response from the server?

  1. Go to this page : http://networkprogramming.wordpress.com/2013/08/06/html-to-pdf-proxy/
  2. Click on the link text "http://www.htmlpdf.com/iframeconvert?url=http://www.google.de&orientation=Portrait&pageSize=A4"

This runs a service at www.htmlpdf.com and converts www.google.de into a pdf and downloads it.

  1. Now open a new tab and paste the same URL either from the page text, from the page source or the URL field and press return and the server returns: Unexpected error occurred, unable to convert this URL to PDF.

I don't get it, why does the link work from a click but not from a new tab?

The page source confirms the real URL as: < a href="http://www.htmlpdf.com/iframeconvert?url=http://www.google.de&orientation=Portrait&pageSize=A4">

I've tried substituting ampersands with '& a m p ;' (without spaces) but that does not work.

Any ideas?

Upvotes: 1

Views: 980

Answers (1)

koddistortion
koddistortion

Reputation: 41

It seems that the service accessible via http://www.htmlpdf.com/iframeconvert? is checking the REFERER of the GET request. In case it there is no REFERER set, you'll get Unexpected error occurred, unable to convert this URL to PDF as a response.

Give it a try on this page: http://www.rexswain.com/httpview.html.

Simply put http://www.htmlpdf.com/iframeconvert?url=http://www.google.de&orientation=Portrait&pageSize=A4 as the URL and send the request once with a referer and once without.

Upvotes: 1

Related Questions