How to debug on Facebook Internal Browser (Mobile)?

后端 未结 5 1873
萌比男神i
萌比男神i 2020-12-15 16:54

I\'m developing website with a lot of HTML5 and CSS3 features. I\'m also using iframe to embed several content on my website. It works fine if I open it using Chrome/Firefox

5条回答
  •  天命终不由人
    2020-12-15 17:18

    If you want to debug a possible error, you can try to catch it and display it.

    Put this at the very top of your code:

    window.onerror = function (msg, url, lineNo, columnNo, error) {
        var string = msg.toLowerCase();
        var substring = "script error";
        if (string.indexOf(substring) > -1){
            alert('Script Error: See Browser Console for Detail');
        } else {
            var message = [
                'Message: ' + msg,
                'URL: ' + url,
                'Line: ' + lineNo,
                'Column: ' + columnNo,
                'Error object: ' + JSON.stringify(error)
            ].join(' - ');
    
            alert(message);
        }
    }
    

    (Source: MDN)

    This will catch and alert your errors.

    Share a link on Facebook (privately), or send yourself a message on Facebook Messenger (easier). To break the cache, create a new URL every time, e.g. by appending a random string to the URL.

    Follow the link and see if you can find any errors.

提交回复
热议问题