Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

browser detection - IE and Netscape

Status
Not open for further replies.

lmarshall

MIS
Jun 11, 2002
108
US
Because I have heard the Flash isn't transparent in Netscape, is there anyway I can have my site detect what browser the user is using and the right page show up?

I have two webpage versions one uses flash other doesn't.

thanks,

lmarshall
 
Hi,

If you can use SSI then do this (you don't use Javascript and it will always work on a users browser, b/c it is parsed by the server before the user sees it):

<!--#if expr=&quot;${HTTP_USER_AGENT} = /MSIE/&quot; -->
<EMBED SRC=&quot;flash.swf&quot; QUALITY=&quot;HIGH&quot; WIDTH=&quot;#&quot; HEIGHT=&quot;#&quot; NAME=&quot;file name&quot;>
<!--#else -->
// show nothing, keep this part blank
<!--#endif -->

Hope this helps!

PS - You will need to change the file extension from .html to .shtml when using any SSI commands. NATE
spyderix.gif

 
Spyderix,

That is a bad way to go about it!! You are saying that if the user is not using IE then dont show it, what about all the other browsers out there?

lmarshall,

If you want to use the server side browser check then you have 2 options, either conditionaly include the flash or redirect to a new page based on the browser.

To redirect the page, you can use the following:

<!--#if expr=&quot;${HTTP_USER_AGENT} = /MSIE/&quot; -->
<meta HTTP-EQUIV=&quot;refresh&quot;
CONTENT=&quot;0; URL=flash.html&quot;>
<!--#set var=&quot;bver&quot; value=&quot;IE&quot; -->
<!--#elif expr=&quot;${HTTP_USER_AGENT} = /Mozilla/ && $bver !=/IE/&quot; -->
<meta HTTP-EQUIV=&quot;refresh&quot;
CONTENT=&quot;0; URL=noflash.html&quot;>
<!--#else -->
<meta HTTP-EQUIV=&quot;refresh&quot;
CONTENT=&quot;0; URL=flash.html&quot;>
<!--#endif -->

Or to conditionally include the items, use the following:

<!--#if expr=&quot;${HTTP_USER_AGENT} = /MSIE/&quot; -->
FLASH CONTENT HERE
<!--#set var=&quot;bver&quot; value=&quot;IE&quot; -->
<!--#elif expr=&quot;${HTTP_USER_AGENT} = /Mozilla/ && $bver !=/IE/&quot; -->
NON FLASH CONTENT HERE
<!--#else -->
FLASH CONTENT HERE
<!--#endif -->

The reason that this requires 2 Flash sections is to cater for any browser that is not either IE or NS. There are other ways to go about this but this is by far the safest as it caters for all browsers and does not rely on any browser setting.

Hope this helps Wullie

sales@freshlookdesign.co.uk

 
Looks like there's a few options there.

May I ask why you wouldn't want to include flash for NS/Mozilla users? [smurf]
01101000011000010110010001110011
 
My flash image is transparent and has to be. In Netscape it covers the entire page with white because I have buttons at the top of the page.

lmarshall
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top