Sorry typo!! On Wed, Apr 6, 2011 at 3:25 AM, Howard Lewis Ship <hls...@gmail.com> wrote:
> Oops, sorry Taha, you got this a bit wrong. > > You use @Inject on a field, so this would be > > @Inject > private Request request; > > > > The rest is the same ... > > ... but Tapestry supports IE conditional stylesheets, which is much > more accurate than checking the User-Agent header: > > @Inject @Path("ie-only.css") > private Asset ieOnlyStylesheet; > > void afterRender() { > javaScriptSupport.importStylesheet(new > StylesheetLink(ieOnlyStylesheet, new StylesheetOptions(null, "IE"))); > } > > On Mon, Apr 4, 2011 at 8:07 PM, Taha Hafeez <tawus.tapes...@gmail.com> > wrote: > > Hi Bogdan, > > > > in your class you have import javascriptSupport and request object > > > > public class MyPage { > > > > @Environmental > > private JavaScriptSupport javaScriptSupport; > > > > @Import > > private Request request; > > > > void afterRender(){ > > String userAgent = request.getHeader("User-Agent"); > > //Your logic > > if(userAgent.contains("MSIE")){ > > javaScriptSupport.importStylesheet(...); > > }else ..... > > } > > } > > > > > > regards > > Taha > > > > > > On Tue, Apr 5, 2011 at 7:27 AM, bogdan_cm <bogdan.iva...@rbccm.com> > wrote: > > > >> Hi, > >> There is one post regarding this here: > >> > >> > http://tapestry.1045711.n5.nabble.com/Using-conditional-comments-with-Import-stylesheet-quot-quot-td3827508.html#a3887176 > >> > >> > http://tapestry.1045711.n5.nabble.com/Using-conditional-comments-with-Import-stylesheet-quot-quot-td3827508.html#a3887176 > >> > >> but I find myself unable to figure out how it's done. Is there a working > >> demo somewhere, or can anyone post a bare bones class-template example > >> please? > >> > >> Thank you, > >> Bogdan. > >> > >> > >> -- > >> View this message in context: > >> > http://tapestry.1045711.n5.nabble.com/Using-Environmental-and-JavaScriptSupport-Object-to-dynamically-load-css-based-on-browser-tp4283102p4283102.html > >> Sent from the Tapestry - User mailing list archive at Nabble.com. > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > >> For additional commands, e-mail: users-h...@tapestry.apache.org > >> > >> > > > > > > -- > Howard M. Lewis Ship > > Creator of Apache Tapestry > > The source for Tapestry training, mentoring and support. Contact me to > learn how I can get you up and productive in Tapestry fast! > > (971) 678-5210 > http://howardlewisship.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >