Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: No Right Click II (on images) doesn't work in Firefox

  1. #1
    Join Date
    Oct 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default No Right Click II (on images) doesn't work in Firefox

    I believe I dutifully followed the instructions for adding this script to my Web page, but it doesn't work properly in Firefox. I have FF version 1.07.

    What happens is, when I right click the image, I get the pop-up dialog box as I should, but when I click OK to dismiss it, I get the very right-click menu that I would have gotten had the script not been present in the code. That is, I get the right-click menu for images, the one that contains the command "Save Image as..." among others.

    If I try this on the DD demo page for this script, it works correctly. Mine is a very simple Web page, and I don't know what could be wrong. Please have a look at my html and tell me!

    Thanks. Here's my test Web page: http://www.radiophile.com/ytr601dd.htm

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Does the same thing here for me too. Even the demo does the same thing if I drag the OK button on the alert over the image before clicking OK. Just out of curiosity, how many buttons does your mouse have? Mine only has two and it looks like the script is set up to key off of the 3rd button on a three button mouse in FF but off of button 2 in IE. I really wouldn't worry about it though as, in any browser you can disable such scripts simply by turning off javascript.
    Last edited by jscheuer1; 10-21-2005 at 05:17 AM.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Oct 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    A-ha! You're right -- it depends on the position of the OK button when you click it to dismiss the dialog box. If it's over an image, you get the Images menu; if it's not over an image, you don't. The demo page for the script is (conveniently!) formatted so the dialog box isn't over the image, so the script "works" on that page.

    I'm aware that these scripts, even if working, are easy to work around. Working around them does, however, require an extra step or two, and I'm convinced that's all that's needed to discourage the majority of plagiarism. (And to answer your question: I have a two-button mouse -- don't the vast majority of PC users? If it works correctly with a three-button mouse that's little comfort.)

    Thanks for figuring out why it works on the demo page and not on mine. Almost all my images are centered on the page, so I was really scratching my head about why it didn't work on every one of my pages I tested. I think this is a real bug in the script; I wonder if there's any way to fix it?

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Try out this version, works here:

    Code:
    <script type="text/javascript">
    
    /*
    Disable right click script II (on images)- By Dynamicdrive.com
    For full source, Terms of service, and 100s DTHML scripts
    Visit http://www.dynamicdrive.com
    Modified here to disable IE image hover menu and
    truly disable right click in FF by jscheuer1 in
    http://www.dynamicdrive.com/forums
    */
    
    var clickmessage="Right click disabled on images!"
    
    function disableclick(e) {
    if (document.all) {
    if (event.button==2||event.button==3) {
    if (event.srcElement.tagName=="IMG"){
    alert(clickmessage);
    return false;
    }
    }
    }
    else if (document.layers) {
    if (e.which == 3) {
    alert(clickmessage);
    return false;
    }
    }
    else if (document.getElementById)
    if (e.which==3&&e.target.tagName=="IMG")
    setTimeout("alert(clickmessage)",0)
    }
    
    function associateimages(){
    for(i=0;i<document.images.length;i++)
    document.images[i].onmousedown=disableclick;
    }
    
    if (document.all){
    document.onmousedown=disableclick
    for (var i_tem = 0; i_tem < document.images.length; i_tem++)
    document.images[i_tem].galleryimg='no'
    }
    else if (document.getElementById)
    document.onmouseup=disableclick
    else if (document.layers)
    associateimages()
    </script>
    Place it at the same location, just above the closing </body> tag. I also added language that disables the IE image bar.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Oct 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    John,

    Zowie! It works! Thanks very much. Thanks also for including language to disable the IE image toolbar, too. It's up and running, together with the No Select Text script, on my test page http://www.radiophile.com/ytr601dd.htm .

    I wonder...should I report this on the Bug Reports forum?

    John

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    If you go to Preferences=>Web Features and click the "Advanced" button next to "Enable Javascript," there is an option to allow/disallow scripts to disable/replace context menus.

    And, yes.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Twey
    If you go to Preferences=>Web Features and click the "Advanced" button next to "Enable Javascript," there is an option to allow/disallow scripts to disable/replace context menus.
    True but, in this case, it has no effect on this script as it technically does not replace or disable the context menu. Rather it launches the alert so soon after the context menu appears that the context menu, although very breifly shown, is rendered useless.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Here I find it the other way around - the alert is shown, then the context menu pops up as soon as it closes. This happens with all "no right click" scripts.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Jul 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Why bother instaling this script when visitors can just press print screen

  10. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Twey
    Here I find it the other way around - the alert is shown, then the context menu pops up as soon as it closes. This happens with all "no right click" scripts.
    That was the behavior of the script under XP/FF before my modifications, did you test this with my modifications? Both I and the OP found they did the trick.

    Quote Originally Posted by eamondo
    Why bother instaling this script when visitors can just press print screen
    I'm with you eamondo, I just get carried away sometimes with whatever the OP wants. It will discourage some people. I think that was all the OP wanted.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •