Html prevent file download






















Now if you want to block access to other images that the user is not supposed to see, I am actually doing it that way:. Div overlaping or background pic setting but users with little sense can easily save all resources by opening inspect element or other developer option.

This will remove any click functionality from a page, but it sure stops people stealing any content! If you want only authorised users to get the content, both the client and the server need to use encryption. For video and audio, a good solution is Azure Media Services, which has content protection and encryption. You embed the Azure media player in your browser and it streams the video from Azure.

For documents and email, you can look at Azure Rights Management, which uses a special client. It doesn't currently work in ordinary web browsers, unfortunately, except for one-off, single-use codes.

I'm not sure exactly how secure all this is, however. As others have pointed out, from a security point of view, once those downloaded bytes are in the "attacker's" RAM, they're as good as gone. I think the best way is to prevent right clicking on your webpage, because that is the most convenient way a normal user try to download the content, and you can consider it as remark if u able to do this only as you are never gonna be able to stop a computer geek or hacker people from downloading it, because once the content is on the internet, it means it is in the public domain already Put the content on google drive and make it download protect.

This way people can only see your documents, pictures but cannot download it. I believe THEOplayer already provides this sort of solution as a paid service, but I'm not so sure about it.

There are video hosting services such as vzaar that have this functionality. As far as I know, that will make it really hard to download directly. Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Ask Question. Asked 12 years, 3 months ago. Active 1 month ago. Viewed k times. Improve this question. Haim Evgi Haim Evgi k 44 44 gold badges silver badges bronze badges. Do you mean require a login to access them? Or do you mean prevent them from being saved out of the browser? I am not sure what's your purpose but if you are displaying your art works lets say, you can use Flash Galleries to make things even harder.

They can do "Print Screen" stuff but still it takes time. Add a comment. Active Oldest Votes. No, it's not possible. If you can see it, you can get it. Improve this answer. Josh Leitzel Josh Leitzel They'll be somewhere on they're computer. If you stream the video instead of hosting the file, you can make it a bit more difficult for users to leech them.

Or, you could do something horrible like embed images in a flash object. Don't post them to your site. Otherwise it is not possible. Chris Ballance Chris Ballance Community Bot 1 1 1 silver badge. Sampson Sampson k 72 72 gold badges silver badges bronze badges. Open the website via window. Disable right-clicks via JavaScript not recommended due to all the side-effects on usability Load the page's HTML code from another file which may check for a specific referer or which may be ROT13 via JavaScript, so it's harder to access the source code.

Cut an image into parts, so it takes some extra work to reconstruct the whole image Add onmousedown events to images, e. Deliver the image via server script e. Videos Stream videos to prevent simple downloading via URL. Wrap videos into a Flash movie. Use some nasty format that supports DRM. Convert texts to images this may decrease display quality , SVGs or Flash Again, I repeat that none of this will stop an experienced user from grabbing the content e. Thank you for any other ideas to complement the above list!

Screenshots of the rendered content at an appropriate magnificantion, manually or automatically stiched together. Also downloaded data stream sniffing using e. Use a user agent that allows the referer to be set explicitly on an external request, such as Wget also works with cookies etc. Use a third-party PDF viewer that does not honor the protection there are several open-source PDF viewers available that could, if no such thing already exists, probably relatively easily by someone with appropriate knowledge, be adapted to ignore the protection flags.

In the end, you will have to discuss with your customer and find out exactly what their need actually is. Maybe one or a combination of the above will provide sufficient protection.

But you'll have to tell them up front: it is not possible to prevent downloading while allowing display, because display implies downloading. Whether this is a problem is another matter that is dependent on the customer's risk analysis in the particular case. If it's not too complicated, you could make a "screenshot" of it and post that on the page. Another small trick is placing a transparent div over it, disabling the right click for less tech advanced users. You could also make a getMeTheFile.

Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?

Learn more. Preventing download of files while allowing them to be viewed Ask Question. Asked 7 years, 7 months ago. Active 7 years, 7 months ago. Viewed 2k times. Improve this question. What kind of documents? It annoys the users, is totally useless in practice, but it may suite your client?

You'll obviously need to render those documents server-side, because they're completely uncontrolled once the customer opens them in their preferred application. In fact, in almost all cases a browser downloads a document before handing it off to a viewer application, because the browser has no idea if the viewer is capable of retrieving that data from a URL.

Take a plain. Notepad can't download it, so your webbrowser will assuming it doesn't open them directly — MSalters. Show 2 more comments. Active Oldest Votes. If you have no other alternatives to force the file to download, you can host it on a file hosting service such as Google Docs.

The most common file types that are affected by this behavior are PDF files and images. The code below will tell the browser to prompt the user to save the file. This link does not have the download attribute. This link has the download attribute.

Read More From Actual Wizard Understanding the Different Parts of an Email Address An email address has four parts; the recipient name, the symbol, the domain name, and the top-level domain.

There are a number of different ways to get the last element of an array in JavaScript.



0コメント

  • 1000 / 1000