Connecting js and css depending on userAgent



  • The following is necessary. Create a js test (check userAgent) + check the case.
    Example:

    If the browser washing, we'll connect these files.

    {   
    /style.css   
    /animation.js   
    }   
    Если опера, то {   
    /style1.css   
    /animation1.js    
    }   
    ...   
    //здесть другие браузеры для ПК   
    ...
    

    If the user comes from a phone or a tablet

    {   
    /style2.css      
    /animation2.js     
    } 
    

    I mean, for the different browsers, connect different files + create a condition that for all those who sit on the sky (for all phones, tablets) - connect other files.
    I repeat, the test is in principle on js.

    upd:
    The complexity of number one is how to connect a separate js file inside.

    <script><script src=""></script></script>
    

    It doesn't work.
    Complicity two. How to check all the phones, the plans and give them a separate file. Because when you check the agent's laser. The user can let the phone install the opera then how do we know he's on the phone? Film on the platform?



  • http://javascript.ru/blog/Plush-Grigorij/Funkciya-opredeleniya-brauzera-ego-versii

    Actually, it's better not to check the browser itself, but his possibilities are that, with all the phones, tablets, the meds are being asked to help.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2