Forum Moderators: open

Message Too Old, No Replies

Disable Left Click + Alert on 2nd Click

         

JAB Creations

7:38 am on Mar 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am having an issue with people left clicking and having their computer decide how to listen to the music on my site. I have hifi/lofi links to left click on for preview and download links for DOWNLOADS! Yah, imagine that!

However I see that the avg. size of the mp3s downloaded is not the full size of the mp3s. This is how I know that this undesirable behavior is occuring.

Here is how I am able to disable left click without the alert...

<a href="http://www.google.com" onclick="return false;">Google></a>

However I want to make a universal JS that will send an alert on the 2nd left click of the link. And I just want to apply this function to the links I desire instead of the whole page. This would force people to use my site as intended. It's not really difficult but people are SOO freaking lazy. :-\

PS - No one please mention the R-button as I have many times subtracted the R word (opposite of left) in order to refine my searchs (without success). Everyone wants to disable the R-button but not the left. I figure this would help people who in the future are not lazy and use their brains. :-)

BjarneDM

10:49 am on Mar 20, 2005 (gmt 0)

10+ Year Member



1) assign a common class name to the URLs you want this functionality enabled on.

2) use document.getElementsByTagName("a") and substring on the class to make an array of the interesting urls. Also, generate a random string that you assign to the class name so that all of the URLs has got a double class name. This script has to be assigned to body onload. The script in 3) can be assigned to the onclick handler.

3) This script has to be assigned to the onclick handler for the URLs. It has to use the array generated in 2) and use it to keep a record of the states of the URLs using the random text string as an index into the array. If you just want to keep the state of the latest URL you can do away with the array, and just check for whether the current click was on the same click as the previous one.

Rambo Tribble

2:25 pm on Mar 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It might be simpler to just attach a property to the individual link objects that holds the toggle status. That way you don't have to mess with keeping the array in sync with the objects it represents.

piskie

2:37 pm on Mar 20, 2005 (gmt 0)

10+ Year Member



Have you checked if XP SP2 will allow this intrusive JS behaviour without all sorts of security warnings and click to allows.

I supect it may not and quite rightly so IMHO.

My mouse and its "Left Click" is My control of My PC and I don't take kindly to any attempts to overide "MY CONTROL OF MY PC".

You would soon be added to my Firewalls Exclusions.

JAB Creations

6:23 pm on Mar 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Piskie, you strike me as the type who would understand the setup of my site. Most non-computer oriented users won't automatically know to r-click and save on the DOWNLOAD link when preview links are already provided. Wasting my bandwidth to have quicktime play in place of the setup I worked hard to create easily overrides a basic user's complaint of ignorance.

If an advanced user is offended that they can not preview a song on my site by clicking on either the dialup or broadband example links then to bad.

Sometimes you have guide the mouse to the cheese.

SpaceFrog

3:14 pm on Mar 21, 2005 (gmt 0)

10+ Year Member



what ever you try to controle with your javascript to avoid a right click, can easily hacked ...