Re: load css file related to detected browser

Wednesday, November 30, 2011

if(!+[1,]){
loadCss('ie.css')
}else{
loadCss('other.css')
}
function loadCss(href){        var link =
document.createElement('link');        link.type = 'text/css';       
link.rel = 'stylesheet';        link.href = href;       
document.getElementsByTagName('head')[0].appendChild(link);    }
On Nov 24, 12:24 am, Pawel_Iks <pawel.labed...@gmail.com> wrote:
> I would like to detect browser via javascript and by DOM load
> appropriate css file.
>
> On 21 Lis, 16:14, Calvin <calvinbus...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Instead of that, put this at the top of your head of your HTML file.
>
> > <!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]-->
> > <!--[if IE 7]>    <html class="no-js ie7" lang="en"> <![endif]-->
> > <!--[if IE 8]>    <html class="no-js ie8" lang="en"> <![endif]-->
>
> > Now target your IE changes in the same resource files by a ie6, ie7,
> > ie8 class.
>
> > Now, you do not have to load separate resource files.
>
> > Calvin
>
> > On Nov 16, 6:34 am, Pawel_Iks <pawel.labed...@gmail.com> wrote:
>
> > > Hello!
>
> > > I would like to write script which works as follow:
>
> > > 1) it detect browser:
> > > 2) if browser=="ie" then it load "ie.css"
> > > 3) else, it load file "other.css"
>
> > > How to do it?

--
You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To post to this group, send email to javascript-information@googlegroups.com.
To unsubscribe from this group, send email to javascript-information+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javascript-information?hl=en.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Copyright © 2010 Web Design | Free Blogger Templates by Splashy Templates | Layout by Atomic Website Templates

Vida de bombeiro Recipes Informatica Humor Jokes Mensagens Curiosity Saude Video Games Animals Diario das Mensagens Eletronica Rei Jesus News Noticias da TV Artesanato Esportes Noticias Atuais Games Pets Career Religion Recreation Business Education Autos Academics Style Television Programming Motosport Humor News The Games Home Downs World News Internet Design Entertaimment Celebrities 1001 Games Doctor Pets Net Downs World Enter Jesus Mensagensr Android Rub Letras Dialogue cosmetics Genexus lasofia thebushrajr wingshock tripedes gorduravegetal dainfamia dejavu-transpersonal jsbenfica republicadasbadanas ruiherbon iranianforaryans eaystcheyl fotosdanadir Só Humor Curiosity Gifs Medical Female American Health Madeira Designer PPS Divertidas Estate Travel Estate Writing Computer Matilde Ocultos Matilde futebolcomnoticias girassol lettheworldturn topdigitalnet Bem amado enjohnny produceideas foodasticos cronicasdoimaginario downloadsdegraca compactandoletras newcuriosidades blogdoarmario arrozinhoii