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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    disbale right click for specific links?

    Hello All,

    I am trying to disable right click only for specific links on the page> I want to create my own pop up menu for these eventually. At present I have the following

    Code:
    <a href='#' onContextMenu="typesclick()">Types</a>
    the function is

    Code:
    function typesclick()
    {
    
    alert("testing");
    return false;
    
    
    }
    The alert appears but the browser context menu also appears. I am using ie7? Any ideas why this is not working?

    Scott Bailey

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    See FAQ No.13.

    "Please note that "No Right Click" scripts (one of the favorite uses of javascript to "protect" a web page) are considered at best a "waste of time" but more often as "user antagonistic" by most of the regulars here."

    You cannot suppress the browser context menu in IE7 - this is a security feature set by the user.

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Leave the right click functionality as it is. As a user I would be annoyed if you will change my mouse's right click functions, so that either I will quit your page and never come back or I will disable javascript to avoid that unpleasent change.

    Use the left click (or mouseover) for contextual menus.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #4
    New Coder
    Join Date
    Jul 2008
    Posts
    48
    Thanks
    1
    Thanked 0 Times in 0 Posts
    put a quick password protect script on the pages you dont want people seeing or uhh "clicking" lol.

    or redirect script
    or a tooltip saying "under-construction"

    or just simply make the link say
    Code:
    <a>Types</a> with no link in it
    ....and change it back until you're done :) there, we all happy :p
    you can even combine these xD

    there's lots more you can do lol
    Last edited by joey,choey; 09-09-2008 at 03:08 PM. Reason: cuz i forgot something lol


  •  

    Posting Permissions

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