hello, all:

I design web pages and was wandering if there is a way so that one can show a design or a web-page on any browser, but the html code (or all respective image files, css, etc) can't be viewed or downlaoded from a browser?? I thought maybe thru php one could do that. I believe one can per example have images appear on browser but have it parsed thru php in a way that they couldn't be dragged-copied, or copy pasted into desktop or other application from a browser...

In other words, be able to protect content.

Thanks, appreciate any feedback!

Dani AI

Generated

Several replies in this thread (for example , , and ) pointed toward the same practical reality: true, foolproof hiding of anything a browser must render is not possible. Below are realistic, actionable ways to reduce exposure and control access — not myths about absolute protection.

Use server-side access control for assets

  • Keep sensitive files out of the public webroot and deny direct URLs.
  • Deliver files through an authenticated endpoint that checks permissions, then hands the file to the web server for efficient delivery (X-Accel-Redirect / X-Sendfile) or streams the bytes after authorization. See NGINX X-Accel-Redirect documentation for the server-side handoff pattern: X-Accel-Redirect (nginx).
  • For scalable, time-limited sharing, use signed or expiring URLs offered by CDNs or object stores (CloudFront signed URLs, S3 presigned URLs) so leaked links stop working: Serving private content with signed URLs (CloudFront).

Deter casual copying on the client side

  • Watermark images, show low-resolution previews, and avoid sending originals until authorization succeeds.
  • Client-side tricks (right-click blocking, obfuscation, Flash/Java wrappers, etc.) only deter novices and can be bypassed. Treat them as UX/obstacle measures, not security.

Operational and legal options

  • Log and rate-limit downloads, use hotlink protection, and keep clear terms of use and takedown procedures for misuse.
  • For high-value media, consider DRM/streaming solutions (video) rather than client-side HTML tricks.

For background on what must remain server-side vs. client-side, see the MDN glossary on client-side vs server-side roles: .

Recommended Answers

All 4 Replies

There is no way to hide HTML or JavaScript code from the user, these are client-side scripts and will need to be processed by the client browser, as such the code will need to be sent and can be viewed. The PHP code cannot alter this since it is a server-side script is processed into HTML output before being sent.

If it makes it to the browser, it's in the cache (on the users machine). Everything is accessible to the user by this point. PHP does the same thing that every other server script does, it parses the code from the web server and sends the client HTML and JavaScript. These are the only things that the browser knows how to interpret (except for vbscript, which only works in IE). There is not a way to prevent the user from stealing HTML.

There is no way to hide HTML or JavaScript code from the user, these are client-side scripts and will need to be processed by the client browser, as such the code will need to be sent and can be viewed.

Although that is true, there are still 2 options on the board for hiding all of the client side code with only a small amount of additional code being displayed. That is, Java/Ajax or Flash. All you need to do is first upload your html files to the server into a hidden folder (a folder with a robots.txt hiding it) then setup a Java or Flash applet to view those pages.
So basically you would just be using the Java/Flash applet to view the webpages while the webpages are in an unknown location. I know bits and pieces of flash if you would like me to try and help you with that and just as a note, no page will need any conversion.

Although that is true, there are still 2 options on the board for hiding all of the client side code with only a small amount of additional code being displayed. That is, Java/Ajax or Flash. All you need to do is first upload your html files to the server into a hidden folder (a folder with a robots.txt hiding it) then setup a Java or Flash applet to view those pages.
So basically you would just be using the Java/Flash applet to view the webpages while the webpages are in an unknown location. I know bits and pieces of flash if you would like me to try and help you with that and just as a note, no page will need any conversion.

Yaps it true but u can also use javascript encoding for only static html page for this u should use some page encoding software which encode the page and only user can see encoded code in javascript.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.