Browser Detection

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Browser Detection

toddvainisi
Hi Folks,

I have some pesky css that works great in everything I've tried except
explorer (where it *sometimes* works).  Any how, I'm wondering if I can
detect the browser with lasso and use  different menu styles if the browser
is IE.  Seems like that couldn't happen since lasso is server side.

Other suggestions are appreciated too.

Thanks guys,

Todd Vainisi



------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Browser Detection

Fletcher Sandbeck
On 2006-08-22 at 13:17 by [hidden email] (todd vainisi):

>I have some pesky css that works great in everything I've tried except
>explorer (where it *sometimes* works).  Any how, I'm wondering if I can
>detect the browser with lasso and use  different menu styles if the browser
>is IE.  Seems like that couldn't happen since lasso is server side.

[Client_Type] will return the browser type.

Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-us) AppleWebKit/418.8 (KHTML, like Gecko) Safari/419.3

We use code like that shown below to customize some CSS rules for different browsers in the admin apps.  If you want Lasso to process your actual CSS file you need to name it something like style.css.lasso.  The browsers don't care what extension your style sheet uses.

[var: 'css_clientype' = (client_type)]

[if: ($css_clientype >> 'MSIE') && ($css_clientype >> 'Mac_PowerPC')]
img.corner_left1,
img.corner_right1
{
        position: relative;
        width: 1px;
        height: 1px;
        top: -13px;
        background: white;
}
[else]
img.corner_left1,
img.corner_right1
{
        position: relative;
        width: 2px;
        height: 2px;
        top: -12px;
}
[/if]

Hope this helps,

[fletcher]
--
Fletcher Sandbeck                         [hidden email]
Director of Product Development       http://www.lassostudio.com
OmniPilot Software, Inc.                http://www.omnipilot.com

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Browser Detection

jasonhuck
There is also Bil's tag:

http://tagswap.net/lp_client_browser





On 8/22/06, Fletcher Sandbeck <[hidden email]> wrote:

> On 2006-08-22 at 13:17 by [hidden email] (todd vainisi):
>
> >I have some pesky css that works great in everything I've tried except
> >explorer (where it *sometimes* works).  Any how, I'm wondering if I can
> >detect the browser with lasso and use  different menu styles if the browser
> >is IE.  Seems like that couldn't happen since lasso is server side.
>
> [Client_Type] will return the browser type.
>
> Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-us) AppleWebKit/418.8 (KHTML, like Gecko) Safari/419.3
>
> We use code like that shown below to customize some CSS rules for different browsers in the admin apps.  If you want Lasso to process your actual CSS file you need to name it something like style.css.lasso.  The browsers don't care what extension your style sheet uses.
>
> [var: 'css_clientype' = (client_type)]
>
> [if: ($css_clientype >> 'MSIE') && ($css_clientype >> 'Mac_PowerPC')]
> img.corner_left1,
> img.corner_right1
> {
>         position: relative;
>         width: 1px;
>         height: 1px;
>         top: -13px;
>         background: white;
> }
> [else]
> img.corner_left1,
> img.corner_right1
> {
>         position: relative;
>         width: 2px;
>         height: 2px;
>         top: -12px;
> }
> [/if]
>
> Hope this helps,
>
> [fletcher]
> --
> Fletcher Sandbeck                         [hidden email]
> Director of Product Development       http://www.lassostudio.com
> OmniPilot Software, Inc.                http://www.omnipilot.com
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription:
> http://www.listsearch.com/lassotalk.lasso?manage
>


--
Find and Share Free Lasso Custom Tags at tagSwap.net!
Download hundreds of open source Lasso custom tags, and post your own
for others to use. RSS feeds track the newest and most popular tags.
http://tagSwap.net/

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Browser Detection

Greg Willits-2
In reply to this post by toddvainisi
On Aug 22, 2006, at 10:17 AM, todd vainisi wrote:

> I have some pesky css that works great in everything I've tried  
> except explorer (where it *sometimes* works).  Any how, I'm  
> wondering if I can detect the browser with lasso and use  different  
> menu styles if the browser is IE.  Seems like that couldn't happen  
> since lasso is server side.
>
> Other suggestions are appreciated too.

Another method (beside Fletcher's) is to define your baseline  
standards compliant CSS without all the Lasso markup, then write  
deviation CSS files which redefine only those pieces that a certain  
browser needs to have different.

Use a small Lasso routine in the <head> to load the files that would  
apply to the browser.

This method allows the browser to cache the CSS files, which we want  
it to do to speed up pages, and still serve browser specific code  
without there being a lot of CSS code redundancy.

Example:

// include the core styles

'<link rel="stylesheet" type="text/css" href="/site/css/
stylesCore.css" />\r';

// include overrides

if: (client_type >> 'MSIE') && (client_type >> 'Mac_PowerPC');
'<link rel="stylesheet" type="text/css" href="/site/css/
stylesMacIE5.css" />\r';
else: whetever else....
'<link rel="stylesheet" type="text/css" href="/site/css/
stylesWhatever.css" />\r';
else: whetever else....
'<link rel="stylesheet" type="text/css" href="/site/css/
stylesWhatever.css" />\r';
else: whetever else....
'<link rel="stylesheet" type="text/css" href="/site/css/
stylesWhatever.css" />\r';
/if;


-- gw
-----------------------------------------------------------------------
www.araelium.com/aredit/ae_and_lasso :: A new, Lasso-friendly, OS X
specific project manager and code editing developmennt application.
www.pageblocks.org :: A comprehensive application framework for Lasso.
-----------------------------------------------------------------------



------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Browser Detection

James Harvard
A week or so ago Jason drew our attention to some JavaScripts that (as I understood it) patch IE to be standards-compliant.

http://www.listsearch.com/lassotalk.lasso?id=166396

How did that work out, Jason?

James

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Browser Detection

jasonhuck
It's not the absolute nirvana I hoped for, but it *is* useful. I've
added it to the repository and it will go into all future sites unless
I find a serious problem with it.

- It seems to fix box-model inconsistencies better with widths than
with heights, and then, better with pixel values than percentages.

- PNG transparency patch works great.

- CSS selectors work pretty well, i.e., I can now use something like
this in IE 6:

    li:after { content: ' > ' }


It's definitely worth a look if IE6 is giving you fits!

- jason





On 8/22/06, James Harvard <[hidden email]> wrote:

> A week or so ago Jason drew our attention to some JavaScripts that (as I understood it) patch IE to be standards-compliant.
>
> http://www.listsearch.com/lassotalk.lasso?id=166396
>
> How did that work out, Jason?
>
> James
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription:
> http://www.listsearch.com/lassotalk.lasso?manage
>


--
Find and Share Free Lasso Custom Tags at tagSwap.net!
Download hundreds of open source Lasso custom tags, and post your own
for others to use. RSS feeds track the newest and most popular tags.
http://tagSwap.net/

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Browser Detection

Brad Hill
In reply to this post by James Harvard
On 8/22/06, James Harvard <[hidden email]> wrote:
> A week or so ago Jason drew our attention to some JavaScripts that (as I understood it) patch IE to be standards-compliant.
>
> http://www.listsearch.com/lassotalk.lasso?id=166396
>
> How did that work out, Jason?
>
> James
>

I applied this to fix png transparency in IE and it worked like a charm.

--
Brad

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Browser Detection

Jonathan Vanherpe (T & T NV)
In reply to this post by toddvainisi
todd vainisi wrote:

> Hi Folks,
>
> I have some pesky css that works great in everything I've tried except
> explorer (where it *sometimes* works).  Any how, I'm wondering if I can
> detect the browser with lasso and use  different menu styles if the
> browser is IE.  Seems like that couldn't happen since lasso is server side.
>
> Other suggestions are appreciated too.
>
> Thanks guys,
>
> Todd Vainisi

Hi,

IMHO, it's not really the best way to involve Lasso (or browser
detection in general) in this. You can google for the evils of browser
detection, and the reasons why it's bad and unreliable and such.

The best way to solve your problem (I think) is using conditional
comments to load an extra css file for IE.

example:
<!--[if lte IE 7]>
<link rel="stylesheet" href="iehacks.css" type="text/css" />
<![endif]-->
(this one loads the external css for any IE version lower than 7.
chances are your default css works in 7)

The great thing about those is that only IE knows them (the other
browsers see them as comments), and your code stays valid.

More on conditional comments:
http://www.quirksmode.org/css/condcom.html
http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp

Jonathan

--
Jonathan Vanherpe
Tallieu & Tallieu
[hidden email]

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Browser Detection

Paul Melia

On Aug 23, 2006, at 2:49 AM, Jonathan Vanherpe (T & T NV) wrote:

> todd vainisi wrote:
>> Hi Folks,
>> I have some pesky css that works great in everything I've tried  
>> except explorer (where it *sometimes* works).  Any how, I'm  
>> wondering if I can detect the browser with lasso and use  
>> different menu styles if the browser is IE.  Seems like that  
>> couldn't happen since lasso is server side.
>> Other suggestions are appreciated too.
>> Thanks guys,
>> Todd Vainisi
>

Even better, though it takes more effort and, in some cases,  
comprises or concessions, is to create a design that can successfully  
operate in all browsers without browser-specific code.
Time and money, in the long run, will be saved and there are  
organizations out there, one being a major client of mine, that  
require no browser-specific code.

Just my two cents,
Paul

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Browser Detection

Bil Corry-3
Paul Melia wrote:
> Even better, though it takes more effort and, in some cases, comprises
> or concessions, is to create a design that can successfully operate in
> all browsers without browser-specific code.
> Time and money, in the long run, will be saved and there are
> organizations out there, one being a major client of mine, that require
> no browser-specific code.

Well, "all browsers" is a casting a pretty wide net, as the number of "browsers" and their various versions is fairly extensive:

http://www.pgts.com.au/nocrawl/pgtsj0302b.html

So ultimately, you *are* deciding to limit your site to certain visitors, based on browser, browser versions, accessibility (e.g. sight-impaired, color-blindness), devices (e.g. PDAs, cell phones), privacy (e.g. cookies, JavaScript), bots (Google et. al.), language (e.g. English, German), and so on.

I do agree with the your sentiment though, making sites that work for as many browsers as possible using a base standard for the site is a good thing.  And for the browsers that don't support the code, having it degrade to something still usable is best.


- Bil


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage