开发者

Hide PDF URL using JS

I have a php page . I need to make it hard for user to get direct download link.For this i need a js function which start downloading pdf after 10sec automatically after page load.开发者_StackOverflow中文版 I dont want to provide a download link at all. Also I cant use onpageload . PDF must download.


Since most of the browsers will tell you where the downloaded file came from, i think you may want to mask the file itself behind a 'temporary' link with mod_rewrite or other custom parameters. You don't need to use JavaScript for this.

After then you can simply push the file with PHP similarly like this solution.


There is absolutely no way to hide a URL from an end user - All they need to do is use Fiddler 2, Firebug or similar tools to view the requested URL


Have your download page redirect to the PHP file that will download it. If it can download it, it will redirect the user back to the previous page, because the download doesn't have the right content type, although it could be just a plain .html file. You don't need Javascript to do this:

<meta http-equiv="refresh" content="10;url=http://mysite/d.php?file=resume">

I recommend the Smart File Download, from zubrag.com, if you don't already have a PHP file specifically for downloading.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜