Results 1 to 2 of 2

Thread: Disable right mouse click script

  1. #1
    Join Date
    Mar 2015
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Disable right mouse click script

    1) Script Title: Disable right mouse click script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex9/noright2.htm

    3) Describe problem:
    This script works fine and stop all right click on image. As I do not want people to download my html5 mp4 video by right click and download, can this script be modified for stopping right click on video?

    Thanks a lot!

  2. #2
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    For HTML5 video, since it's implemented simply using the VIDEO tag, you can modify the script easily to also screen for that tag:

    Code:
    document.oncontextmenu = function(e){
    	var target = (typeof e !="undefined")? e.target: event.srcElement
    	if (target.tagName == "IMG" || target.tagName == "VIDEO" || (target.tagName == 'A' && target.firstChild.tagName == 'IMG'))
    		return false
    
    }
    Not sure about Flash based video players however.
    DD Admin

Similar Threads

  1. Replies: 3
    Last Post: 02-05-2010, 05:28 AM
  2. Disable right mouse click script II (on images)
    By newbeeold in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 07-25-2006, 08:55 PM
  3. Disable right mouse click script
    By Jim Weinberg in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 02-01-2006, 07:49 PM
  4. Disable right mouse click script
    By skidmore33 in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 08-09-2005, 12:10 AM
  5. Disable right mouse click script
    By skidmore33 in forum ASP
    Replies: 2
    Last Post: 08-09-2005, 12:10 AM

Bookmarks

Posting Permissions

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