View Full Version : Anylink Drop Down Menu problem with Safari 2.0

10-13-2007, 03:53 PM
1) Script Title: Anylink Drop Down Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm

3) Describe problem: In Safari 2. the drop down menu disappears when you place your mouse on it.

I am using the onclick version of the menu. (<a href="default.html" onclick="return dropdownmenu(this, event, menu1, '200px')" onmouseout="delayhidemenu()">) I have the drop down menus in a separate .js file.

Except for Safari 2.0, it works correctly in all other browsers (to my knowledge), including Safari 1 and the new Safari 3 for windows.

Can anyone help? I like the onclick feature, as opposed to an onmouseover menu.

Thank you.

10-14-2007, 08:20 AM
I kind of doubt that there will be too many folks around here that can help out with this script that also have Safari 2.0 to test on.

I don't even have a Mac, so I cannot say with any certainty that my suggestions will help. Two things jump out at me though. Make sure this:

var hidemenu_onclick="yes" //hide menu when user clicks within menu?

is set to "no", and try increasing this:

var disappeardelay=250 //menu disappear speed onMouseout (in miliseconds)

to - say, 350.

I have another hunch if that doesn't work out. To test that theory, make up a blank page and put this:

<script type="text/javascript">

in the body. See what it alerts in Safari 2.0 and get back to me.

10-14-2007, 08:35 AM
John, that alerts "true".

I just tested in Safari 2.

It sorta works, but it is strange.

If I really try to click it, it will work.

But if I just click it randomly, it sorta flickers then goes away after a split second.

Also, if it does work, it goes away onmouseout (original texT), and keeps the menu active only for the first two menu items; the third menu item doesn't keep the menu active-- it closes.

It's a bit hard to explain the behaviour, and certainly not stable.

10-14-2007, 03:43 PM
>I don't even have a Mac, so I cannot say with any certainty that my suggestions will help.

I don't own a Mac either, so I was only recently made aware of the problem. The Mac server that hosts the site is not new and the latest version of Safari that I can run is 1.3.2. Testing using Safari 2 is a problem for me also.

I am the webmaster for an informational site for a state agency that needs to be accessible to anyone, so I need to accomodate Safari 2. However, I really like the onclick function of the Anylink Drop Down menu.

Anylink drop down with CSS works in Safari 2, so one option I have is to switch to that menu. But I do like the onclick feature and I like having the menu is a .js file so I can easily change it for my 100+ page site.

Is it possible to include Safari 2 in the if statements (if (ie4||ns6)) and direct Safari 2 users to the alternate menu page? I don't know how to write that statement. I have limited coding abilities.

I'd appreciate any help you can give me.



10-14-2007, 04:43 PM
needs to be accessible to anyone

Then a javascript menu with javascript code that contains the actual links is not for you. Any browser can have javascript disabled, some don't even have it as an option, there's just no javascript. For those users, there would be no menu.

10-14-2007, 05:33 PM
Thanks, John.

You make a valid point.

I should clarify what I meant to say - we are concerned about those folks using old or donated computers at community centers, small libraries, etc., who may be using an old browser, or who can't change the browser. We are not particularly concerned about those who can turn their javascript off and on.

Is it possible to send Safari 2.0 users to the alternate menu pages?



10-14-2007, 05:41 PM
Many users cannot turn javascript on or off. In some browsers, for certain handicaps, javascript just isn't available. For other users, javascript is turned off, but they either don't know how to or don't have permission/access to turn it on.

10-14-2007, 06:46 PM

A pure CSS menu would have accessibility issues also.

Is there an option for a DD menu that wouldn't exclude anybody? Or will I always exclude "somebody" if I use anything other than straight links?

I appreciate your help.


10-14-2007, 08:26 PM
I commented out the .js file in my code, and the Anylink Drop Down Menu still works. It takes the user to the alternate menu pages. I originally used this great DD menu because it incorporates that option. Now I'm confused.

I've convinced myself that there has to be a work around for Sarafi 2.0, but I'm just not smart enough to figure it out.

Could there be a work around or should I give it up?


10-14-2007, 08:56 PM
The alternate menu pages only work if they exist and are kept current, but yes that is an excellent way to use the anylink menu accessibly.

I know how to exclude Safari, but not specific version numbers. If you have a test, for example I will use the test for Safari that I know, the one that doesn't single out any specific version:


You could do something really straightforward like return true from the drop down:

function dropdownmenu(obj, e, menucontents, menuwidth){
return true;
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"

return clickreturnvalue()

It would be a good idea to do the same here:

function delayhidemenu(){
return true;
if (ie4||ns6)

Any browser excluded in such a manner from those functions will work as though the script isn't on or liked to the page. That's only when using the onclick method of dropping down. If you are using the default hover method, you would need to add it here as well:

function clickreturnvalue(){
return true;
if (ie4||ns6) return false
else return true

10-14-2007, 09:48 PM
Thank you John. It works in Safari 1 and 3, so I assume it will do likewise in 2. I'll have a friend test it in Safari 2 tomorrow.

I do keep the alternate pages updated. We do have more than a few users with older browsers.

I hadn't thought to exclude all Safari browsers. I'll see how my client likes that.

Thank you again. I appreciate your time and expertise.


10-14-2007, 10:44 PM
I was playing around with Safari 3 win, and if the other Safaris follow its example, this should work for singling out Safari whole version numbers. Put this code in your script before anything else:

var safari_test=['vendor','userAgent','appVersion'];
for(var j in safari_test)
for (var i = 1; i < 3; i++)
if(/Version\/\d+\.\d+ {0,1}Safari/.test(navigator[safari_test[i]])){
safari_test.ver=parseInt(navigator[safari_test[i]].replace(/^.*Version\/(\d+\.\d+) {0,1}Safari.*$/, '$1'));

Once you have that before your other code, you can replace wherever we did this:

return true;


return true;

10-14-2007, 11:43 PM
Generally, you try to make your menus, etc., as compatible as possible with the most browsers as possible, then have a working fallback for those that don't, down the plain links in text only browsers.

10-19-2007, 10:27 PM
Yes, this works to send just Safari 2 users to the alternate pages. I also discovered that the onmouseover version works in Safari 2., just not the onclick version.

I really appreciate your help. This is a great DD menu and I'll keep using it.

Thanks again.