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 15 of 15
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Posts
    436
    Thanks
    1
    Thanked 0 Times in 0 Posts

    silent no left-click script

    I looked for and couldn't find.
    I tried to convert a script with alert to a silent one and didn't succeed.
    Can anyone help please?

    Thanks

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    If users can't left click, how are they gonna get around your site?

  • #3
    Regular Coder
    Join Date
    Jan 2004
    Location
    Georgia
    Posts
    306
    Thanks
    0
    Thanked 0 Times in 0 Posts
    see this thread http://codingforums.com/showthread.php?s=&threadid=4437



    please dont disable left or right click, it doesnt do anything for you and it pisses people off
    ~Designer's Toolz~

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Posts
    436
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Come on!
    Please answer my question!
    I don't want to disable it (and if one wants to do it, who are you to judge him? visitors'll judge him - they won't come to his webpages...)

    All I want to do is to disable it from <head> and then onLoad, to enable it (because when someone clicks on something - the page stops loading).
    I want the page to load before anyone can click.

    Thanks

  • #5
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Try the following:
    Code:
    window.onclick=function(){return false;}
    window.onload=function(){
        delete window.onclick;
    }
    If that doesn't work, try removing delete and instead setting it to null.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    IE listens on document.onclick not window.onclick, unlike in Moz where it listens on both. But disabling it won't disable the clicks in links and buttons.

  • #7
    Regular Coder
    Join Date
    Jul 2002
    Posts
    436
    Thanks
    1
    Thanked 0 Times in 0 Posts
    maybe I can solve the problem from the problematic function:
    Code:
    function showCont(articleID){
       contTd = eval(document.getElementById("ContTD_" + articleID));
       if(contTd.style.display == "none") {
           contTd.style.display = "block";
       } else {
           contTd.style.display = "none";
       }
    }
    and:
    Code:
    <a href="javascript:showCont("12")">
    But if someone clicks this anchor before the page loads, all of the loading process is stopped.
    Is there a way to void it?

  • #8
    Regular Coder
    Join Date
    Feb 2003
    Posts
    638
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You might try using mouse capture for IE... there's an example here.
    hmm... ?

  • #9
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    Code:
    function showCont(articleID){
       var contTd = document.getElementById("ContTD_" + articleID);
       if (!contTd) return;
       if(contTd.style.display == "none") {
           contTd.style.display = "block";
       } else {
           contTd.style.display = "none";
       }
    }
    Note: You don't have to use eval().

  • #10
    Regular Coder
    Join Date
    Jul 2002
    Posts
    436
    Thanks
    1
    Thanked 0 Times in 0 Posts
    ok.
    but still, clicking before full load, stops the loading :\

  • #11
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok, for IE only:

    code:
    -------------------------------

    onload = new Function()
    {
    document.body.onmousedown = (document.readyState == "completed") return true : return false ;
    }
    --------------------------------

    just guessing, really :-)

  • #12
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just as an aside, why is it important that the full page load before the user can continue?

    I ask this because I often click through intermediate pages on some sites before they are completely loaded. There's usually nothing of interest for me on those pages except the next link so I don't want to have to wait. Also some pages never do finish loading, the advertisements on web pages can be problematic so if you pages have any ads, those ads can cause a "never finished loading" problem and this code could basically lock out your user.

    Then as a second question, why has this become a problem? Is there something about that page which makes it very slow in loading? Why doesn't the page come up so quickly that the user doesn't have time to click on a link within the page before the page completes loading. It's not always possible to make a page that quick but if early clicking is a problem, then figuring out how to make the page load near instantly is the best possible solution and scripts like the one suggested above would (and should) fall futher down the chain of solutions.

    I ask those question mainly because I want you to think about the why and what. Maybe there's a solution that'll work better for you and your users than this idea.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #13
    Regular Coder
    Join Date
    Jul 2002
    Posts
    436
    Thanks
    1
    Thanked 0 Times in 0 Posts
    The page loads quite quickly.
    The problem is the hide/show links.
    When a user clicks on the link (which triggers the function I attached before), the page stops loading (some little gif's at the bottom of the page won't load after clicking the hide/show link).

    Most people won't even notice the problem, but fast-clickers like me will...

    Maybe the problem is with my JS.
    Why does clicking (the hide/show links) stop the page from loading anyway?

    (PS: I have no ads in this pages whatsoever )

  • #14
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, you understand why you need this.

    I have one case where I needed something similar but I went a different route. I placed a <div> over the whole page styled like this:

    Code:
    div.lDiv
    	{
    	font-size: 95pt;
    	background-color: gray; 
    	font-family: Arial, sans-serif;
    	position:absolute; 
    	left: 0px; 
    	top: 0px; 
    	width: 100%; 
    	height: 100%;
    	text-align: center;
    	}
    called this function onload:

    Code:
    function fadeInPage() 
    	{
    	if (document.layers)
    		{
    		document.layers['loadingDiv'].visibility = 'hidden';
    		return true;
    		}
    	if (document.getElementById("loadingDiv").filters.alpha.opacity > 0)
    		{
    		document.getElementById("loadingDiv").filters.alpha.opacity -= 5;
    		setTimeout("fadeInPage()",100)
    		}
    	else
    		{
    		document.getElementById('loadingDiv').style.visibility = "hidden"
    		}
    	}
    and the DIV itself follows the <body> tag:

    Code:
    <div id="loadingDiv" class="lDiv" style="filter:alpha(opacity=50);">
    	Please Wait
    </div>
    It should be noted that the use of the MS filter has caused some difficulties, it seems that some IE 6 users have trouble because the IE 6 install silently failed to complete and the filters didn't install which breaks the page for those users. I'm reworking that page soon and the filter will become history then.

    The upshot of what I did is that this put's an overlay on the page with a "Please Wait" notice yet the user can see the page loading through the overlay which is removed when the page is complete. The user can't access anything on the page though until the overlay is removed. In my case this was done because there's javascript running which builds a huge table (in some cases, in other cases it's a small table) and I needed to hold the user back until the table was complete (sound familiar?).
    Last edited by Roy Sinclair; 03-22-2004 at 06:30 PM.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #15
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    The div will only cover the visible screen from the top. If the page is long and has scrollbar, the user can still click the document that is not covered by the div.


  •  

    Posting Permissions

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