Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Aug 2013
    Posts
    27
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Puzzling Problem

    <script>
    function FindJump(gogo)
    {
    gogo='';
    str=navigator.userAgent; // Agent is unique for our purposes
    /* lotza working code edited out */
    var isGek=str.indexOf("Gecko"); // Presumes is in all variants mentioned
    if (isGek>=0) { gogo='PCbase.html'; }
    var z = gogo;

    // So, if not found, ASSuME we have mobile phone browser
    if (z='') { gogo='Mobile.html'; }
    document.writeln('3 gogo='+gogo+'|<BR>');
    document.writeln('4 z='+z+'|<BR>');
    return 'foo'+z+'||' //gogo;
    };
    </script>

    <script>
    str=navigator.userAgent; // Agent is unique for our purposes
    document.writeln(str+"|<BR>");
    // <a onTimeout="doOut(this, '/'+str', 'sass');return false;"></a><br>
    var jmp=FindJump("hi");
    document.writeln('jmp='+jmp);
    </script>

    /* on a PC, one sees: /* on a mobile phone, one sees:
    3 gogo=PCbase.html| jmp=Mobile.html|
    4 z=|
    jmp=foo||

    */

    For a mobile phone:
    1) What is seen is reasonable, as contents of "str" had been previously
    detected and the proper string was returned earlier in the function.

    For a PC:
    1) Line 3 shows that "z" was not empty; if it was, then "gogo"
    would contain 'Mobile.html'
    2) But line 4 then shows "z" as empty. WTF?
    3) Likewise,the next line shows "z" as empty.

    *** Another, "alternate" version

    <script>
    function FindJump(gogo)
    {
    gogo='';
    str=navigator.userAgent; // Agent is unique for our purposes
    /* lotza working code edited out */
    document.writeln('2 gogo='+gogo+'|<BR>');

    // So, if not found, ASSuME we have mobile phone browser
    if (gogo='')
    { var z='Mobile.html';
    document.writeln('3 z='+z+'|<BR>');
    document.writeln('3 gogo='+gogo+'|<BR>');
    return z;
    }

    return 'barf';
    };
    </script>

    In this case, the same problem exists; for a PC i get:
    2 gogo=|
    jmp=barf

    Help??
    Last edited by robertbaer; 04-14-2014 at 03:40 PM. Reason: Add another version


 

Posting Permissions

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