www.webdeveloper.com
Results 1 to 3 of 3

Thread: SCRIPT5007: Unable to get property '1' of undefined or null reference

  1. #1
    Join Date
    Jun 2013
    Posts
    1

    SCRIPT5007: Unable to get property '1' of undefined or null reference

    i have a error in my console
    SCRIPT5007: Unable to get property '1' of undefined or null reference
    i am unable to solve this error please help me!!!


    // Internet Explorer
    if ( sAgent.indexOf("msie") != -1 && sAgent.indexOf("mac") == -1 && sAgent.indexOf("opera") == -1 )
    {
    var sBrowserVersion = navigator.appVersion.match(/MSIE (.\..)/)[1] ;
    return ( sBrowserVersion >= 5.5 ) ;
    }

  2. #2
    Join Date
    Mar 2007
    Location
    U.K.
    Posts
    1,127
    Quote Originally Posted by javedusmani2 View Post
    Code:
             var sBrowserVersion = navigator.appVersion.match(/MSIE (.\..)/)[1] ;
    That statement assumes that there will always be a match. If there isn't then there's an error.

    Code:
    var sBrowserVersion = ( sBrowserVersion = navigator.appVersion.match(/MSIE (.\..)/) ) ? sBrowserVersion[1] : 0;
    Better yet, as anyone will tell you - don't perform unreliable browser detection.
    Where used, return should be executed unconditionally and always as the last statement in the function.

    That's my signature, it's not part of the damn post!

  3. #3
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,648
    why not just check for 'document.all' ?
    xxx: Guess Buddhist riddle: "What is the sound of one hand clapping?"
    yyy: facepalm

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles