You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by abo <ta...@weberhofer.at> on 2004/06/15 18:06:04 UTC
how to determine which browser is being used?
hey list,
I need to know which browser is being used, because I need to include
some additional css styles for ie.
I could get this form the http header, but how can I access the header
from tapestry?
public IAsset getStyle()
{
if ( isExplorer() )
return getAsset("ie");
}
could anyone help me with this?
thanks
andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: how to determine which browser is being used?
Posted by abo <ta...@weberhofer.at>.
Thank you, it works great!
yes, stylesheets are very nice, but unfortunately sometimes it's not
possible to have one solution for every browser :(
for example: if you want to position divs absolut on a scrolling page
(don't let them scroll..), it's easy to do this with css, as long, as
you don't use IE. there are some hacks, but they are not perfect (don't
work if you use XHTML and IE)
cheers,
andreas
Darren Foltinek wrote:
> This is how we get the user-agent from the HTTP headers. This code
> sits in a "PageWrapper" component that generates, among other things,
> the <HEAD> tag which embeds the needed stylesheets.
>
> HttpServletRequest request =
> getPage().getRequestCycle().getRequestContext().getRequest();
> String userAgent = request.getHeader ("user-agent");
>
> By the way, using style sheets is the BEST way I've ever used to work
> around the mess of browser issues - highly recommended!
>
> There's examples of parsing the user-agent string to extract the
> browser around the net, but if you want I could post that too.
>
> Cheers,
> -- Darren
>
>
>> I need to know which browser is being used, because I need to include
>> some additional css styles for ie.
>> I could get this form the http header, but how can I access the
>> header from tapestry?
>>
>> public IAsset getStyle()
>> {
>> if ( isExplorer() )
>> return getAsset("ie");
>> }
>>
>> could anyone help me with this?
>>
>> thanks
>> andreas
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: how to determine which browser is being used?
Posted by Darren Foltinek <da...@frontrange.ca>.
This is how we get the user-agent from the HTTP headers. This code sits in
a "PageWrapper" component that generates, among other things, the <HEAD>
tag which embeds the needed stylesheets.
HttpServletRequest request =
getPage().getRequestCycle().getRequestContext().getRequest();
String userAgent = request.getHeader ("user-agent");
By the way, using style sheets is the BEST way I've ever used to work
around the mess of browser issues - highly recommended!
There's examples of parsing the user-agent string to extract the browser
around the net, but if you want I could post that too.
Cheers,
-- Darren
>I need to know which browser is being used, because I need to include some
>additional css styles for ie.
>I could get this form the http header, but how can I access the header
>from tapestry?
>
>public IAsset getStyle()
>{
> if ( isExplorer() )
> return getAsset("ie");
>}
>
>could anyone help me with this?
>
>thanks
>andreas
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org