Results 1 to 8 of 8

Thread: No Right Click(The Special Way)

  1. #1
    Join Date
    Nov 2009
    Location
    BEHIND YOU
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default No Right Click(The Special Way)

    This Is Easy

    Go To http://www.dynamicdrive.com/dynamicindex9/noright3.htm And Get The Code
    Should Be Something Like This :
    Add Into Head Tag
    Code:
    <script language=JavaScript>
    <!--
    
    //Disable right click script III- By Renigade (renigade@mediaone.net)
    //For full source code, visit http://www.dynamicdrive.com
    
    var message="";
    ///////////////////////////////////
    function clickIE() {if (document.all) {(message);return false;}}
    function clickNS(e) {if 
    (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {(message);return false;}}}
    if (document.layers) 
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
    
    document.oncontextmenu=new Function("return false")
    // --> 
    
    </script>
    Next, Add
    Code:
    <div id="ie5menu" class="b1" onMouseover="highlightie5(event)" onMouseout="lowlightie5(event)" onClick="jumptoie5(event)" display:none>
    Hello! No Ripping !
    </div>
    <script language="JavaScript1.2">
    
    //set this variable to 1 if you wish the URLs of the highlighted menu to be displayed in the status bar
    var display_url=0
    
    var ie5=document.all&&document.getElementById
    var ns6=document.getElementById&&!document.all
    if (ie5||ns6)
    var menuobj=document.getElementById("ie5menu")
    
    function showmenuie5(e){
    //Find out how close the mouse is to the corner of the window
    var rightedge=ie5? document.body.clientWidth-event.clientX : window.innerWidth-e.clientX
    var bottomedge=ie5? document.body.clientHeight-event.clientY : window.innerHeight-e.clientY
    
    //if the horizontal distance isn't enough to accomodate the width of the context menu
    if (rightedge<menuobj.offsetWidth)
    //move the horizontal position of the menu to the left by it's width
    menuobj.style.left=ie5? document.body.scrollLeft+event.clientX-menuobj.offsetWidth : window.pageXOffset+e.clientX-menuobj.offsetWidth
    else
    //position the horizontal position of the menu where the mouse was clicked
    menuobj.style.left=ie5? document.body.scrollLeft+event.clientX : window.pageXOffset+e.clientX
    
    //same concept with the vertical position
    if (bottomedge<menuobj.offsetHeight)
    menuobj.style.top=ie5? document.body.scrollTop+event.clientY-menuobj.offsetHeight : window.pageYOffset+e.clientY-menuobj.offsetHeight
    else
    menuobj.style.top=ie5? document.body.scrollTop+event.clientY : window.pageYOffset+e.clientY
    
    menuobj.style.visibility="visible"
    return false
    }
    
    function hidemenuie5(e){
    menuobj.style.visibility="hidden"
    }
    
    function highlightie5(e){
    var firingobj=ie5? event.srcElement : e.target
    if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems"){
    if (ns6&&firingobj.parentNode.className=="menuitems") firingobj=firingobj.parentNode //up one node
    firingobj.style.backgroundColor="highlight"
    firingobj.style.color="black"
    if (display_url==1)
    window.status=event.srcElement.url
    }
    }
    
    function lowlightie5(e){
    var firingobj=ie5? event.srcElement : e.target
    if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems"){
    if (ns6&&firingobj.parentNode.className=="menuitems") firingobj=firingobj.parentNode //up one node
    firingobj.style.backgroundColor=""
    firingobj.style.color="826A92"
    window.status=''
    }
    }
    
    function jumptoie5(e){
    var firingobj=ie5? event.srcElement : e.target
    if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems"){
    if (ns6&&firingobj.parentNode.className=="menuitems") firingobj=firingobj.parentNode
    if (firingobj.getAttribute("target"))
    window.open(firingobj.getAttribute("url"),firingobj.getAttribute("target"))
    else
    window.location=firingobj.getAttribute("url")
    }
    }
    
    if (ie5||ns6){
    menuobj.style.display=''
    document.oncontextmenu=showmenuie5
    document.onclick=hidemenuie5
    }
    
    </script>
    <style type="text/css">
    .b1{
    position:absolute;
    width:130px;
    background-color:white;
    border:1px dotted #FFFFFF;
    line-height:12px;
    color: #AAAAAA;
    font-size:8pt;
    font-family:trebuchet ms;
    text-align:left;
    padding-bottom:5px;
    padding-top:5px;
    padding-left:5px;
    padding-right:2px;
    z-index:50;
    visibility:hidden;
    }
    </style>
    Add Both To The Head Tag
    The Completed Code:
    Code:
    <script language=JavaScript>
    <!--
    
    //Disable right click script III- By Renigade (renigade@mediaone.net)
    //For full source code, visit http://www.dynamicdrive.com
    
    var message="";
    ///////////////////////////////////
    function clickIE() {if (document.all) {(message);return false;}}
    function clickNS(e) {if 
    (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {(message);return false;}}}
    if (document.layers) 
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
    
    document.oncontextmenu=new Function("return false")
    // --> 
    
    </script>
    <div id="ie5menu" class="b1" onMouseover="highlightie5(event)" onMouseout="lowlightie5(event)" onClick="jumptoie5(event)" display:none>
    Hello! No Ripping !
    </div>
    <script language="JavaScript1.2">
    
    //set this variable to 1 if you wish the URLs of the highlighted menu to be displayed in the status bar
    var display_url=0
    
    var ie5=document.all&&document.getElementById
    var ns6=document.getElementById&&!document.all
    if (ie5||ns6)
    var menuobj=document.getElementById("ie5menu")
    
    function showmenuie5(e){
    //Find out how close the mouse is to the corner of the window
    var rightedge=ie5? document.body.clientWidth-event.clientX : window.innerWidth-e.clientX
    var bottomedge=ie5? document.body.clientHeight-event.clientY : window.innerHeight-e.clientY
    
    //if the horizontal distance isn't enough to accomodate the width of the context menu
    if (rightedge<menuobj.offsetWidth)
    //move the horizontal position of the menu to the left by it's width
    menuobj.style.left=ie5? document.body.scrollLeft+event.clientX-menuobj.offsetWidth : window.pageXOffset+e.clientX-menuobj.offsetWidth
    else
    //position the horizontal position of the menu where the mouse was clicked
    menuobj.style.left=ie5? document.body.scrollLeft+event.clientX : window.pageXOffset+e.clientX
    
    //same concept with the vertical position
    if (bottomedge<menuobj.offsetHeight)
    menuobj.style.top=ie5? document.body.scrollTop+event.clientY-menuobj.offsetHeight : window.pageYOffset+e.clientY-menuobj.offsetHeight
    else
    menuobj.style.top=ie5? document.body.scrollTop+event.clientY : window.pageYOffset+e.clientY
    
    menuobj.style.visibility="visible"
    return false
    }
    
    function hidemenuie5(e){
    menuobj.style.visibility="hidden"
    }
    
    function highlightie5(e){
    var firingobj=ie5? event.srcElement : e.target
    if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems"){
    if (ns6&&firingobj.parentNode.className=="menuitems") firingobj=firingobj.parentNode //up one node
    firingobj.style.backgroundColor="highlight"
    firingobj.style.color="black"
    if (display_url==1)
    window.status=event.srcElement.url
    }
    }
    
    function lowlightie5(e){
    var firingobj=ie5? event.srcElement : e.target
    if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems"){
    if (ns6&&firingobj.parentNode.className=="menuitems") firingobj=firingobj.parentNode //up one node
    firingobj.style.backgroundColor=""
    firingobj.style.color="826A92"
    window.status=''
    }
    }
    
    function jumptoie5(e){
    var firingobj=ie5? event.srcElement : e.target
    if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems"){
    if (ns6&&firingobj.parentNode.className=="menuitems") firingobj=firingobj.parentNode
    if (firingobj.getAttribute("target"))
    window.open(firingobj.getAttribute("url"),firingobj.getAttribute("target"))
    else
    window.location=firingobj.getAttribute("url")
    }
    }
    
    if (ie5||ns6){
    menuobj.style.display=''
    document.oncontextmenu=showmenuie5
    document.onclick=hidemenuie5
    }
    
    </script>
    <style type="text/css">
    .b1{
    position:absolute;
    width:130px;
    background-color:white;
    border:1px dotted #FFFFFF;
    line-height:12px;
    color: #AAAAAA;
    font-size:8pt;
    font-family:trebuchet ms;
    text-align:left;
    padding-bottom:5px;
    padding-top:5px;
    padding-left:5px;
    padding-right:2px;
    z-index:50;
    visibility:hidden;
    }
    </style>
    Demo: My Site

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    that's easy to break. Just turn javascript off. read more...

  3. #3
    Join Date
    Dec 2009
    Location
    Pakistan
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Use This way to Right-Click Disabled...

    In body tag of your page.. write oncontextmenu="return false".

    For example,

    Code:
    <body oncontextmenu="return false"></body>

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    actually, that doesn't even work in Firefox 3 with javascript on. But if it works in your browser, why don't you try disabling javascript and seeing what happens?

  5. #5
    Join Date
    Nov 2009
    Location
    BEHIND YOU
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    @traq - Put A Noscript Tag Around
    <noscript><meta http-equiv="0; url=noscript" rel="NoScript" ></meta></noscript>
    Once you do this, they will be redirected to http://yourdomain.com/noscript/
    And Ask Them To On Javascript

  6. #6
    Join Date
    Nov 2009
    Location
    BEHIND YOU
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    @VampireCoder - You Can Do That , But My Tutorial Does Not Use That

  7. #7
    Join Date
    Nov 2009
    Location
    BEHIND YOU
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    @traq - Good Idea,
    Might Do This
    Code:
    <!--[if it IE] -->
    No Not IE!
    <![end if]-->
    LOL
    Your Site Like This Won't Allow IE
    Code:
    <!--[if Firefox 1]-->
    I DO NOT ALLOW OLD PEOPLE COME!
    GO HAVE 100 BIRTHDAYS LA!
    <![end if]-->
    <!--[if Firefox 2]-->
    I DO NOT ALLOW OLD PEOPLE COME!
    GO HAVE 100 BIRTHDAYS LA!
    <![end if]-->
    LOL!!!!!!
    Ermm,
    Ask Them Upgrade Java Maybe.

  8. #8
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    ...?
    I'm not quite sure what you're trying to do there.
    Quote Originally Posted by amosngweien
    <!--[if it IE] -->
    No Not IE!
    <![end if]-->
    lt (not it ) means "less than", e.g. if lt IE 6 means "if less than (earlier version than) IE 6". it won't work without the version number. If you want any version, just write if IE.
    Quote Originally Posted by amosngweien
    <!--[if Firefox 1]-->
    I DO NOT ALLOW OLD PEOPLE COME!
    GO HAVE 100 BIRTHDAYS LA!
    <![end if]-->
    <!--[if Firefox 2]-->
    I DO NOT ALLOW OLD PEOPLE COME!
    GO HAVE 100 BIRTHDAYS LA!
    <![end if]-->
    Only works in internet explorer. Firefox doesn't read conditional comments at all.
    Quote Originally Posted by amosngweien
    <noscript><meta http-equiv="0; url=noscript" rel="NoScript" ></meta></noscript>
    FireFox lets me disable meta redirects as well.
    Quote Originally Posted by amosngweien
    Ask Them Upgrade Java[script?] Maybe.
    Well, if they have to do it voluntarily anyway, why not just *ask* them not to right-click? There's no real point in trying to prevent it.

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
  •