Ssi And Javascript - Browser Friendly Navigation

free web hosting
Free Web Hosting > Computers & Tech > Programming > Scripting > Server Side Includes (SSI)

Ssi And Javascript - Browser Friendly Navigation

swiideman
I'd be willing to 'donate' to anyone who can solve this dilemna.

I have two navigations, one that works for IE6+, NS7+, & Firefox and one that doesn't. I found a great redirect script, but I'm not interested in redirecting.

I'd rather have the old navigation show up if the browser is not IE6+, NS7+ or Firefox.

I'm using SSI on this site, so I'd like to simply have:

---------------------------------

if navName = Microsoft Internet Explorer & version >= MSIE 6.0 OR navName = Netscape & version >= 5.0

THEN display header1.asp [header1.asp has a css-driven navigation - mostly text]

ELSE
if navName = Firefox'
THEN display header1.asp
ELSE display header2.asp [header2.asp includes a HEAVY javascript navigation]

--------------------------------

I'm using IIS, so the Perl script <!--#whatever include=header1.asp --> won't work for me. No Perl please.

--------------------------------

To keep the file size down, I don't want the older navigation to be loaded UNLESS they have an older browser. Here's the actual syntax I'm using (which isn't working): [some of the code for verNumIE and verNumOt is in an external file]. This script works for redirects, but for not creating includes.

PLEASE HELP. smile.gif

----------------------------------

<script language="JavaScript">
if (navigator.appName == 'Microsoft Internet Explorer') {
verNumIE() ;
} else {
verNumOt() ;
}

if ((navName == 'Microsoft Internet Explorer' && brNum >= 'MSIE 6.0') || (navName == 'Netscape' && brNum >= '5.0')) {
document.write('<!--#include virtual="/ssi/header1.asp" -->');
}else {

if (navName == 'Firefox') {
document.write('<!--#include virtual="/ssi/header1.asp" -->');
} else {
document.write('<!--#include virtual="/ssi/header2.asp" -->');
}
}
</script>

------------------------------------------

 

 

 


Reply

bluefish
This is physically impossible. You see, when a webpage is loaded, it is requested from the server. The server then runs the SSIs, etc. and sends the page to the client. On the clients machine, the page is loaded and e.g. javascript is run. You are trying to add SSIs in the Javascript part of the process, but it has already finished processing SSIs. It might be possible to do this with AJAX, but I think the simplest solution would be a cookie based approach. When you figure out whether a browser is compatible or not, set a cookie.
CODE
<script>if(compatible)
document.cookie="version=new";
else
document.cookie="version=old";
location.href="#"; //Refresh the page</script>

Then in your server-side language, you need to check the cookie. If
a) the cookie does not exist;
Display the javascript to check the compatibility.
cool.gif the cookie has a value of "new";
Include the new page
c) the cookie has a value of "old";
Include the old page.

 

 

 


Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Recent Queries:-
  1. fast pageload in vista - 622.42 hr back. (1)
Similar Topics

Keywords : Ssi Javascript Browser Navigation


    Looking for ssi, javascript, browser, friendly, navigation






*SIMILAR VIDEOS*
Searching Video's for ssi, javascript, browser, friendly, navigation
advertisement




Ssi And Javascript - Browser Friendly Navigation