Support » Plugin: WP BrowserUpdate » JS console Uncaught SyntaxError

  • Resolved tristanmason

    (@tristanmason)


    Hi, and thanks for this great plugin – it has been really useful for us.

    I was looking at the console for another reason and just noticed a syntax error “Uncaught SyntaxError: Unexpected token }

    It appears to be coming from the notify: line below.

    <script type="text/javascript">
    var $buoop = {
    notify:{e:10,f:45,o:37,s:8,c:},
    reminder:0,
    test:false,
    newwindow:true,
    style:"",
    insecure:"",
    unsupported:"",
    mobile:"",
    api:5
    };

    I fixed it on my site by moving the ‘,c:’ in line 26 in WP-BrowserUpdate.php to be inside the !isset() statement so it only outputs that key if there is also a value. Is that an ok way to fix this?

    OLD
    $browser = 'e:'.$wpbu_vars[0].',f:'.$wpbu_vars[1].',o:'.$wpbu_vars[2].',s:'.$wpbu_vars[3].',c:'.(!isset($wpbu_vars[4])?'':$wpbu_vars[4]);

    NEW
    $browser = 'e:'.$wpbu_vars[0].',f:'.$wpbu_vars[1].',o:'.$wpbu_vars[2].',s:'.$wpbu_vars[3].(!isset($wpbu_vars[4])?'':',c:'.$wpbu_vars[4]);

    ___
    (Edit: fix code tag backtick on wrong line)

    • This topic was modified 11 months, 4 weeks ago by tristanmason.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘JS console Uncaught SyntaxError’ is closed to new replies.