Hi, Sorry if this is a lame question, but I just can't get around a 'browser detection' javascript on a particular website with the LWP UserAgent's agent method. This is what I used and the site does work on the browser which sets the same agent. ( Safari and Firefox on Mac ).

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: +1.9.1.9) Gecko/20100315 Firefox/3.5.9 Content-Length: 71 Content-Type: application/x-www-form-urlencoded
Here is the section of javascript that stops me from viewing the page:
function broswerDetection(){ var appName = navigator.appName; var appVersion = navigator.appVersion; var userAgent = navigator.userAgent; var browserSupported = false; if(appName == "Netscape") { // the browser could be a Netscape o +r Firefox if(userAgent.indexOf("Firefox") == -1){ // the browser is Netscape, then we flag that the netscape + not supported browserSupported = false; } else if((userAgent.indexOf("Navigator") != -1) && (userAgent.i +ndexOf("Firefox") != -1) ){ // the broswer is Netscape v9.0 browserSupported = false; } else{ // this is actually a Firefox browser var firefoxIndex = userAgent.indexOf("Firefox") + 8; if(parseInt(userAgent.charAt(firefoxIndex)) >= 1){ browserSupported = true; } } } else if(appName == "Microsoft Internet Explorer"){ var version = 0.0; if(userAgent.indexOf("Opera") == -1){ // Microsoft Internet Explorer if(appVersion.indexOf("MSIE") != -1){ var temp = appVersion.split("MSIE"); version = parseFloat(temp[1]); } if(version >= 6.0){ browserSupported = true; } } else{ // Opera broswer, flag the broswer not supported browserSupported = false; } }
Could someone please help me understand why LWP can't get around this check ?


In reply to LWP UserAgent's agent method and browser check by roxylandmusic

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.