Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Sep 2012
    Posts
    160
    Thanks
    42
    Thanked 0 Times in 0 Posts

    Question Can I Use Javascript to Achieve This?

    ...
    Hi Folks!

    I want every time anyone tries to copy or download content from my website, an alert box appears warning, "The contents of this website are copyrighted. Unauthorized use is strictly prohibited." I am thinking Javascript can accomplish that because all I need is a function that detects copying and downloading, and then adding an "if" statement to display an alert box bearing the warning message. My limitation is that I know not which and where to get such a function. Please help, thank you.

    Thuita.
    ...

  2. #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    8,055
    Thanks
    2
    Thanked 808 Times in 797 Posts
    HTML can accomplish that without any need for JavaScript. Your visitors will have already downloaded the page before they see anything at all.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  3. #3
    Regular Coder
    Join Date
    Sep 2012
    Posts
    160
    Thanks
    42
    Thanked 0 Times in 0 Posts
    ...
    Thank you felgall for the response. Am afraid I don't know how to achieve that with HTML. Please guide me; thank you.
    ...

  4. #4
    Regular Coder
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    311
    Thanks
    0
    Thanked 42 Times in 40 Posts
    I believe Felgall was being sarcastic.

    You can put a message warning about it in your HTML, but there's not a blasted thing you can do to ACTUALLY stop or even intercept any attempt to save the page or copies of it's content. By it's very nature HTML and web content is in fact insecure as the user MUST download it in order for the browser to show ANY of it. The copy already exists before you're scripting would even RUN!

    ... much less anything you did in scripting can easily be slapped aside by disabling scripting or layering user javascript atop it using something like greasemonkey.

    Hence why when people ask me "How do I stop people from downloading/copying my content" the ONLY advice I can give is "don't put it online in the first place!"
    From time to time the accessibility of websites must be refreshed with the blood of designers and owners; it is its natural manure.
    http://www.cutcodedown.com

  5. Users who have thanked deathshadow for this post:

    Thuita Maina (03-31-2016)

  6. #5
    Regular Coder
    Join Date
    Sep 2012
    Posts
    160
    Thanks
    42
    Thanked 0 Times in 0 Posts
    ...
    Thank you deathshadow for the response. Actually, my aim is just to warn people but not to stop them from copying or downloading. But the warning should appear only when they attempt to copy or download. How can I do that with HTML?
    ...

  7. #6
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    8,055
    Thanks
    2
    Thanked 808 Times in 797 Posts
    Quote Originally Posted by Thuita Maina View Post
    But the warning should appear only when they attempt to copy or download. How can I do that with HTML?
    ...
    No you can't do that at all - they have to download the HTML BEFORE they can see anything you display via HTML. For them to get the warning before they attempt to download anything you need to transmit it telepathically before they finish clicking on any link to your site or before they finish typing your domain name in their address bar.

    The web works by first downloading all the files a web page uses and only then displaying them in the browser. By the time they can see the HTML they already have a copy of all your files.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  8. Users who have thanked felgall for this post:

    Thuita Maina (03-31-2016)

  9. #7
    New to the CF scene
    Join Date
    Mar 2016
    Posts
    5
    Thanks
    0
    Thanked 1 Time in 1 Post
    HTML and web content is in fact insecure as the user MUST download it in order for the browser to show ANY of it. The copy already exists before you're scripting would even RUN!

  10. Users who have thanked StrawberryF for this post:

    Thuita Maina (04-07-2016)


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •