Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Ssi And Javascript, Browser Friendly Navigation
swiideman
post Sep 20 2005, 10:04 PM
Post #1


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 1
Joined: 20-September 05
Member No.: 8,592



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>

------------------------------------------
Go to the top of the page
 
+Quote Post
bluefish
post May 3 2007, 02:00 AM
Post #2


Member [ Level 2 ]
Group Icon

Group: Members
Posts: 71
Joined: 16-December 06
Member No.: 18,419



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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Javascript Keyevents ?(3)
  2. JavaScript: Hide And Show Any Element With CSS(6)
  3. Most Seo Friendly Forum(7)
  4. Free Or Opensource Database/schema Browser?(6)
  5. Browser Capabilities(9)
  6. How To Design The Popup Menu Item Using Javascript(2)(0)
  7. How To Design The Popup Menu Item Using Javascript(1)(0)
  8. 12 Javascript Image Galleries(0)
  9. Google Chrome(49)
  10. Browser Based Text Games(2)
  11. Future Browser.. :p(9)
  12. Need A Javascript To Enable / Disable Buttons(2)
  13. Browser Based Rpg(2)
  14. Web Editor(0)
  15. Build Your Own Adventure, New Browser Based Game(11)
  1. I Need Help With Javascript.(7)
  2. Include Function For Javascript(7)
  3. JavaScript Frames & Querystring(4)
  4. Xnview 1.93.4(2)
  5. New Browser Based Game, Create Or Conquer(4)
  6. Conditional Statements Of Javascript(1)
  7. New Wordpress Navigation Plugin(0)
  8. Help Creating A Browser-based Rpg(5)
  9. Best Way To Learn Javascript(9)
  10. Web Browser Games(8)
  11. Javascript Operators(0)
  12. Hack Websites(8)
  13. Website Navigation Hover Buttons Stick So Made Css Today(7)
  14. Create And Import JavaScript Modules For A Large Script(2)
  15. Ever Needs To Find Out A Table Height Or With With JavaScript(2)


 



- Lo-Fi Version Time is now: 2nd December 2008 - 11:03 AM