How do I test which web browser is used?

Author Message

Aleksandar Adam

Thursday 12 April 2007 12:54:29 am

Hello,

I would like to test which browser is used in my template (because of some incompatibilities between Explorer and Firefox.)

If it is <b>Explorer</b> I would like to show <b>page 1 </b>

and

If it is <b>Firefox</b> I would like to show <b>page 2 </b>

How do I proceed?

Thanks in advance
Aleksandar

Kristof Coomans

Thursday 12 April 2007 12:58:01 am

Hi Aleksander

What about all the other browsers out there? I think showing different pages to different browsers is a bad habit. Maybe there's another way to solve the incompatibility issues? If you tell us what's going wrong then maybe we can help.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Aleksandar Adam

Thursday 12 April 2007 1:03:19 am

I have pictures on my page and they are placed in layers -

Explorer shows layers correctly, but not the Firefox.

I had to make one more page with pictures in layers which will work with Firefox.

So it is not ez issue it is problem with layers.

Michael Lee

Thursday 12 April 2007 1:41:07 am

Is it possible to use <div> instead?
you can use CSS hacks to solve most browser incompatibilities. Please refer to http://www.webdevout.net/css-hacks.

Michael Lee | Managing Director | ZerusTech Ltd | www.zerustech.com

Skype: zerustech

Aleksandar Adam

Thursday 12 April 2007 1:58:22 am

Layers are defined in stylesheet like this:

#Layer1 {
	position:absolute;
	width:118px;
	height:128px;
	z-index:1;
	left: 116px;
	top: 166px;
}

#Layer2{

etc.
....

so I had to define Layer1 for Explorer and Layer1 for Firefox in different html pages.

If it is some work around to do in one file I will be very gratefull.

Nabil Alimi

Thursday 12 April 2007 2:05:08 am

Hi,

What do you actually call "layer" ?
To which selector are your css styles applied ?

Besides, I agree with Kristof.

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Aleksandar Adam

Thursday 12 April 2007 2:51:22 am

I'll try as Michael said, with css hacks,

<link href="all_browsers.css" rel="stylesheet" type="text/css">
<!--[if IE]> <link href="ie_only.css" rel="stylesheet" type="text/css"> <![endif]-->

I hope it works in ez, I'll try it tomorrow.

Thanks for all your help guys.

Best regards
Aleksandar

Peter Putzer

Thursday 12 April 2007 2:59:09 am

This hasn't got anything todo with eZ publish. Conditional comments do work very well (if all you need is to differentiate between IE and non-IE). For more advanced browser detection, there's always the eZBrowserSniff contribution ( http://ez.no/community/contribs/template_plugins/ezbrowsersniff_operator ). If you really need it - most things should be solvable by clean CSS coding.

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

Softriva .com

Friday 20 April 2007 4:28:56 am

IMHO, this a css question. This site the best for such question.

http://www.sitepoint.com/forums/forumdisplay.php?f=53

OOzy

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.