Can certain browsers be forced to ignore the Menu?

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
tepidarium
Mega User
Mega User
Posts: 169
Joined: Sun Oct 05, 2003 4:21 am

Post by tepidarium »

Hi - I have another code example and question:

On my page, the initial menu is embedded in a table cell...what I would like to have happen is if the browser is Netscape 4 - load text links; if the browser is anything else, load the first menu. At the top of the page I already have the snippet of javascript that kevin wrote to have netscape 4 ignore the intial menu code. I don't know javascript - this is what I came up with but the section portion of the code, the ELSE statement doesn't work -- could someone help me? : Here is the code:

Code: Select all

<script   language="javascript"> 
_NS4 = (document.layers) ? true : false; 
if (_NS4) { 
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/aboutus/index.html>About Us</a> | ");
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/academics/index.html> Academics</a> | ");
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/admissions/index.html>Admissions</a> | ");
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/alumni/index.html>Alumni</a> | ");
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/faculty/index.html>Faculty/Staff</a> | "); 
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/students/index.html>Students</a> | ");
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/search/index.html>Search</a> | ");
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/sitemap/index.html>Site Map</a> | "); 
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/index.html>Home</a>");
  // do ns4 stuff 
} 
else { 
document.write("
  <script>
with(milonic=new menuname("Main Menu")){
style=mainStyle;
alwaysvisible=1;
orientation="horizontal";
position="relative";
aI("text=About Us;url=http://www.citytech.cuny.edu/aboutus/index.html;status=About Us;showmenu=About;itemwidth=82;itemheight=18;align=center;");
aI("text=Academics;url=http://www.citytech.cuny.edu/academics/index.html;status=Academics;showmenu=Academics;itemwidth=82;itemheight=18;align=center;");
aI("text=Admissions;url=http://www.citytech.cuny.edu/admissions/index.html;status=Admissions;showmenu=Admissions;itemwidth=82;itemheight=18;align=center;");
aI("text=Alumni;url=http://www.citytech.cuny.edu/alumni/index.html;status=Alumni;itemwidth=82;itemheight=18;align=center;");
aI("text=Faculty/Staff;url=http://www.citytech.cuny.edu/faculty/index.html;status=Faculty/Staff;showmenu=Faculty;itemheight=18;itemwidth=83;align=center;");
aI("text=Students;url=http://www.citytech.cuny.edu/students/index.html;status=Students;showmenu=Students;itemwidth=82;itemheight=18;align=center;");
aI("text=Search;url=http://www.citytech.cuny.edu/search/index.html;status=Search;showmenu=Search;itemwidth=82;itemheight=18;align=center;");
aI("text=Site Map;url=http://www.citytech.cuny.edu/sitemap/index.html;status=Site Map;itemwidth=82;itemheight=18;align=center;");
aI("text=Home;url=http://www.citytech.cuny.edu/mm-pop.html;status=Home;itemheight=18;itemwidth=83;align=center;");
}
drawMenus();
</script>
  
  // do non-ns4 stuff, like loading menu scripts. 
} 
</script>");
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi Tep,

So, if I understand correctly, the code from your last post is going in the table where you normally have your main menu, right? Congrats on figuring out the if part for the NS4 code (the document.write() stuff). Looks to me, however, like the else part has some syntax issues. Mainly, it looks like you are trying to have a script write a script... not necessary, since the js code for the menu is already javascript and is it already inside of <script> tags. Try this:

Code: Select all

<script   language="javascript">
_NS4 = (document.layers) ? true : false;
if (_NS4) {
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/aboutus/index.html>About Us</a> | ");
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/academics/index.html> Academics</a> | ");
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/admissions/index.html>Admissions</a> | ");
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/alumni/index.html>Alumni</a> | ");
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/faculty/index.html>Faculty/Staff</a> | ");
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/students/index.html>Students</a> | ");
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/search/index.html>Search</a> | ");
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/sitemap/index.html>Site Map</a> | ");
document.write("<a href="http://websites.milonic.com/citytech.cuny.edu/index.html>Home</a>");
}
else {
with(milonic=new menuname("Main Menu")){
style=mainStyle;
alwaysvisible=1;
orientation="horizontal";
position="relative";
aI("text=About Us;url=http://www.citytech.cuny.edu/aboutus/index.html;status=About Us;showmenu=About;itemwidth=82;itemheight=18;align=center;");
aI("text=Academics;url=http://www.citytech.cuny.edu/academics/index.html;status=Academics;showmenu=Academics;itemwidth=82;itemheight=18;align=center;");
aI("text=Admissions;url=http://www.citytech.cuny.edu/admissions/index.html;status=Admissions;showmenu=Admissions;itemwidth=82;itemheight=18;align=center;");
aI("text=Alumni;url=http://www.citytech.cuny.edu/alumni/index.html;status=Alumni;itemwidth=82;itemheight=18;align=center;");
aI("text=Faculty/Staff;url=http://www.citytech.cuny.edu/faculty/index.html;status=Faculty/Staff;showmenu=Faculty;itemheight=18;itemwidth=83;align=center;");
aI("text=Students;url=http://www.citytech.cuny.edu/students/index.html;status=Students;showmenu=Students;itemwidth=82;itemheight=18;align=center;");
aI("text=Search;url=http://www.citytech.cuny.edu/search/index.html;status=Search;showmenu=Search;itemwidth=82;itemheight=18;align=center;");
aI("text=Site Map;url=http://www.citytech.cuny.edu/sitemap/index.html;status=Site Map;itemwidth=82;itemheight=18;align=center;");
aI("text=Home;url=http://www.citytech.cuny.edu/mm-pop.html;status=Home;itemheight=18;itemwidth=83;align=center;");
}
drawMenus();
}
</script>
Kevin
tepidarium
Mega User
Mega User
Posts: 169
Joined: Sun Oct 05, 2003 4:21 am

Post by tepidarium »

Kevin, thank you, thank you - that is it!

YAY!!!!! :P :D :P :D :!: :!:
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

This is excellent if it works, a couple of questions.

Would this work out of a table just from the menu placing on top of a white background?

If the menu works in netscape 4, then what doesn't work, perhaps if a netscape 4 menu without any images, just plain text and drop down submenus would work also?

Thanks,
maz
tepidarium
Mega User
Mega User
Posts: 169
Joined: Sun Oct 05, 2003 4:21 am

Post by tepidarium »

maz wrote:This is excellent if it works, a couple of questions.

Would this work out of a table just from the menu placing on top of a white background?

If the menu works in netscape 4, then what doesn't work, perhaps if a netscape 4 menu without any images, just plain text and drop down submenus would work also?

Thanks,
maz
Maz - i'm cuccrently running it on a test page:
http://www.citytech.cuny.edu/mm-xns4-div2.html

This replaces milonic menu with a top hierarchy text link menu in NN4!!!
WOO!!![/code]
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

I don't have the browser to test, looks fine in Safari.

Do submenus work in Netscape 4? I think I'd try a simple menu if they do.

Thanks,
maz
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Looks good, tep, and works as advertised in NS4 (don't ask where I found that piece of junk!).

Since today is rag-day, I'd lighten up the blue in the menu links a bit. It's tough to see against the black.
John
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

Well, rag on me John, what can I do, I don't have Netscape to see what to do, nor a table.

maz
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

That was a rag on tep, not you... :D
John
tepidarium
Mega User
Mega User
Posts: 169
Joined: Sun Oct 05, 2003 4:21 am

Post by tepidarium »

jgillett wrote:Looks good, tep, and works as advertised in NS4 (don't ask where I found that piece of junk!).

Since today is rag-day, I'd lighten up the blue in the menu links a bit. It's tough to see against the black.
yep, yep...I'm actually using an altered stylesheet on my local computer so when I finally upload this it should look different...thanks though ;)
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Well, finally, I'm back. Kevin wrote way back when:
Ruth: Very interesting idea (loading v3 menu for NS4). And definitely do-able. I believe tepidarium would still run into the flash problem, although v3 has a div hiding function also (and I also wrote some div hiding scripts for v3 that were definitely effective against NS4).

Kevin
My question was for my site. Because of the color play I do with the style and on/off class I would really like to be able to call V3 for Netscape 4 versions. Especially now since the newer V5 has the link and vlink properties which it is reading from the style sheet. I have just deleted those and used the html font code for any text links on the pages, and the menu just uses the colors I have listed for text now, but in Netscape 4 that means it is now making all the menu text [which is links of course] the danged blue link default color. Until that was done V5 worked ok in NN4, just taking the font colors I had listed.

Ruth
pavia
Super Advanced
Super Advanced
Posts: 39
Joined: Fri Aug 16, 2002 2:39 pm

Post by pavia »

To follow up on Ruth's inquiry about loading Version 3 for Netscape 4...

Kevin says it's definitely do-able.

Uh, okay...how? :-)

More specifically, how to do it if currently using Version 5 and the plain old horizontal implementation with a screen position of center?

This would be the perfect solution for those of us who have to include usability for NS4...and would truly be a godsend(!)
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

I haven't seen Hergio or Kevin posting anything lately and they were the ones helping with so many of our way out script questions :) at least all the ones I was asking about. I've been wondering where they are. Maybe just overwhelmed in projects. Hope they are OK.

Ruth
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

DUH :oops: Are we perhaps getting too involved here? It just crossed my mind that instead of trying to call two different menu systems ie v3 and v5, would we be able to just tell nn4 to use one menu_data.js file which was a simple design for that particular browser and the other browsers to use the main one with all our fancy stuff? That way we'd be one menu system and pretty much the same coding and links, just prehaps a simpler style and function design? Or wouldn't that be possible?

Ruth
pavia
Super Advanced
Super Advanced
Posts: 39
Joined: Fri Aug 16, 2002 2:39 pm

Post by pavia »

I guess it would be possible but the problems I'm seeing with Version 5 in Netscape 4 aren't really style-related. Like, it's not that there's too much fancy-schmancy stuff in the menu_data.js file...for whatever reason(s), Version 5 just blows up in Netscape 4.

See, this way, if I could load Version 3 for NS4, I could stop whining about how NS4 sucks and doesn't really work with Version 5 of the menu. For me, it would be worth the extra work of maintaining two different systems. You haven't experienced any freaky, unexplainable stuff in NS4?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Well, I don't know what problems you are seeing, I haven't seen a single one except those related to the style I'm trying to get. If there are issues you might post them, also have you got the latest version 5.06, perhaps the issues where fixed in it.

Ruth
pavia
Super Advanced
Super Advanced
Posts: 39
Joined: Fri Aug 16, 2002 2:39 pm

Post by pavia »

The main problem (the insurmountable one) using Version 5 of the menu in Netscape 4 is that after a few passes of the mouse over menu items, the menu ceases to work. It just freezes up, in whatever state it was in...and with no consistent pattern. I did post the issue awhile ago...so did others needing NS4 functionality. Never got resolved. :-(
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Try posting it as a new topic seeing if it's been resolved or if the cause has been found. And, have you updated to the newest files, we're at 5.06 now. Many fixes have been done.

Ruth
pavia
Super Advanced
Super Advanced
Posts: 39
Joined: Fri Aug 16, 2002 2:39 pm

Post by pavia »

I'm up-to-date on the fixes.

I basically gave up on expecting Version 5 to work flawlessly with Netscape 4. It's understandably not a priority for the developer because NS 4 sucks and is old. That's why figuring how to code javascript to load Version 3 of the menu for NS 4 browsers would be the perfect compromise. I just hope this request for some assistance doesn't get buried...
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

pavia wrote:Kevin says it's definitely do-able.... Uh, okay...how? :-) ...
Let's assume that your file names for v3 and v5 are standard. For v5 the menu scripts for dom browsers are milonic_src.js and mmenudom.js, and the data file is menu_data.js. For v3 the menu script is mmenu.js and the data file is menu_array.js. You can load these differentially, v3 for NS4, and v5 for everything else, like so:

Code: Select all

<script language="javascript">
_NS4 = (document.layers) ? true : false;
if (_NS4) {
  document.write("<scr"+"ipt language=JavaScript src=menu_array.js><\/scr"+"ipt>");
  document.write("<scr"+"ipt language=JavaScript src=mmenu.js><\/scr"+"ipt>");
}
else {
  document.write("<scr"+"ipt language=JavaScript src=milonic_src.js><\/scr"+"ipt>");
  document.write("<scr"+"ipt language=JavaScript src=mmenudom.js><\/scr"+"ipt>");
  document.write("<scr"+"ipt language=JavaScript src=menu_data.js><\/scr"+"ipt>");
}
</script>
As I recall, v3 was best loaded in the <body>, so you could put the above script as the first few lines after the opening <body> tag. Alternatively, you could split it up, loading v5 stuff in the <head> and v3 stuff in the <body>, like so:

Code: Select all

<head>
.
.
.
<script language="javascript">
_NS4 = (document.layers) ? true : false;
if (! _NS4) {  // v5 stuff for non-NS4
  document.write("<scr"+"ipt language=JavaScript src=milonic_src.js><\/scr"+"ipt>");
  document.write("<scr"+"ipt language=JavaScript src=mmenudom.js><\/scr"+"ipt>");
  document.write("<scr"+"ipt language=JavaScript src=menu_data.js><\/scr"+"ipt>");
}
</script>
.
.
.
</head>

<body>
<script language="javascript">
if (_NS4) {  // v3 stuff for NS4
  document.write("<scr"+"ipt language=JavaScript src=menu_array.js><\/scr"+"ipt>");
  document.write("<scr"+"ipt language=JavaScript src=mmenu.js><\/scr"+"ipt>");
}
</script>
.
.
.
</body>
Of course, you would set path names to the .js files as necessary. Give that a go... hope it helps,

Kevin
Post Reply