2 Replies - 1494 Views - Last Post: 18 July 2012 - 02:03 PM

#1 polska03  Icon User is offline

  • D.I.C Regular

Reputation: 5
  • View blog
  • Posts: 302
  • Joined: 28-November 09

allow html anchor tag href, but not link in browser?

Posted 18 July 2012 - 01:49 PM

Hello, I do not know if this is possible as it sounds impossible. I have a php program that open files via <a> tag ( so it is a list of files on the page and when clicked downloads them). I am wondering if it is possible so that the programs anchor tag is allowed to download when on the page, but when someone types the files path in the URL of a browser it gets blocked. I am hoping Apache can distinguish the difference somehow?

Cheers

This post has been edited by polska03: 18 July 2012 - 01:54 PM


Is This A Good Question/Topic? 0
  • +

Replies To: allow html anchor tag href, but not link in browser?

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9487
  • View blog
  • Posts: 35,773
  • Joined: 12-June 08

Re: allow html anchor tag href, but not link in browser?

Posted 18 July 2012 - 02:03 PM

Are you asking on how to create a unique download path so people have to go through your specific site for files and not a direct link to?
Was This Post Helpful? 0
  • +
  • -

#3 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4399
  • View blog
  • Posts: 12,255
  • Joined: 18-April 07

Re: allow html anchor tag href, but not link in browser?

Posted 18 July 2012 - 02:03 PM

No, the web server only knows that a web client (typically a browser) is issuing a GET request. This could be because they clicked a link or they typed in a URL. The browser sends the request the same in either case. That is, a GET header followed by any number of optional header fields.

None of which tell the server how the request was initiated.

Having said that, you could potentially check if they were referred to the page (like via a link) vs direct (typed in the URL) using something like PHP's HTTP_REFERER. But this is terribly unreliable in that some browsers can manipulate this or even not provide a referrer at all.

:)
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1