1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    17
    Vote Rating
    0
    tr1x is on a distinguished road

      0  

    Default Answered: Detecting if isWebkit Browser or supports sencha touch

    Answered: Detecting if isWebkit Browser or supports sencha touch


    Hallo,

    how can i detect if the Browser supports "Sencha Touch 1.1" (WebKit).
    In "Sencha Touch 2.0" you can do:

    Code:
    if(Ext.browser.is.WebKit){// WebKit specific code here}
    Is there a way to do that in Sencha Touch 1.1?

    Thanks!

  2. Hi tr1x.
    Actually in Touch 1, there is no browser check function available.
    However, you can use the Ext.is and Ext.supports singleton classes to check if your browser capabilities, or, even better, you can apply a regex to the "userAgent" property of "navigator" object.

    This property on webkit desktop browser should be something like:

    Code:
    Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22
    Hope this helps.

  3. #2
    Sencha User
    Join Date
    Jun 2011
    Posts
    17
    Vote Rating
    0
    tr1x is on a distinguished road

      0  

    Default dirty solution

    dirty solution


    What about this litle solution

    Code:
    if(!Ext.is.Android && !Ext.is.Blackberry && !Ext.is.iOS){
        //do some stuff
    }

  4. #3
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,384
    Vote Rating
    14
    Answers
    148
    AndreaCammarata will become famous soon enough AndreaCammarata will become famous soon enough

      0  

    Default


    Hi tr1x.
    Actually in Touch 1, there is no browser check function available.
    However, you can use the Ext.is and Ext.supports singleton classes to check if your browser capabilities, or, even better, you can apply a regex to the "userAgent" property of "navigator" object.

    This property on webkit desktop browser should be something like:

    Code:
    Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22
    Hope this helps.
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    CEO at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata


  5. #4
    Sencha User
    Join Date
    Jun 2011
    Posts
    17
    Vote Rating
    0
    tr1x is on a distinguished road

      0  

    Default thx

    thx


    hey thx for the tip.

    this is my final solution:

    Code:
    if((/(WebKit)/i).test(navigator.userAgent) == false){
        //do some cool stuff
    }

  6. #5
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,384
    Vote Rating
    14
    Answers
    148
    AndreaCammarata will become famous soon enough AndreaCammarata will become famous soon enough

      0  

    Default


    You are welcome
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    CEO at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata