How to load some JS only for IE

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to load some JS only for IE

Herbert König
Hi,

for WebCharts we need excanvas.js only for IE type browsers.

Protochart uses the following header:
<!--[if IE]><script language="javascript" type="text/javascript" src="lib/excanvas.js"></script><![endif]-->

The ensureJavascriptFor....InHeader all use WebPage>>addHeader:value:
to build the tags around the script which obviously doesn't work due
to the asymmetric use of the '!'.

I currently load excanvas.js into every browser.

I would prefer not to use HTML magic like the above but simply do:

clientBrowser = 'IE' ifTrue:
  [self ensureJavascriptForExcanvasminInHeader.

Any hints?

Thanks,

Herbert                          mailto:[hidden email]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: How to load some JS only for IE

Janko Mivšek
Hi Herbert,

To see if browser is IE, ask the request:

        aRequest isFromMSIE

or look at the whole user agent header:

        aRequest userAgent

Best regards
Janko


Herbert König pravi:

> Hi,
>
> for WebCharts we need excanvas.js only for IE type browsers.
>
> Protochart uses the following header:
> <!--[if IE]><script language="javascript" type="text/javascript" src="lib/excanvas.js"></script><![endif]-->
>
> The ensureJavascriptFor....InHeader all use WebPage>>addHeader:value:
> to build the tags around the script which obviously doesn't work due
> to the asymmetric use of the '!'.
>
> I currently load excanvas.js into every browser.
>
> I would prefer not to use HTML magic like the above but simply do:
>
> clientBrowser = 'IE' ifTrue:
>   [self ensureJavascriptForExcanvasminInHeader.
>
> Any hints?
>
> Thanks,
>
> Herbert                          mailto:[hidden email]
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>

--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: How to load some JS only for IE

Herbert König
Hi Janko,


JM> aRequest isFromMSIE
JM> or look at the whole user agent header:
JM> aRequest userAgent
thanks, I knew it was there :-)


Cheers,

Herbert                            mailto:[hidden email]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida