How to save the JavaScript errors in file

后端 未结 5 1464
栀梦
栀梦 2020-12-16 07:48

Need a solution for saving log of JavaScript errors. For automated testing any site with support popular web browsers (IE, FF, Chrome).

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-16 08:37

    The simple/best way to do :)

    In simple steps:

    1. Write a JavaScript error trapping code.
    2. Add Ajax request/response module to send the trapped error to your server.
    3. at the server store your Javascript errors to a log/database.
    4. If needed, provide a functionality to access the log remotely.

    Logging to a file on client-side has limitations:

    1. Supported only by IE (using ActiveX Objects)
    2. Obviously, files are stores on client side. Not at the server.

提交回复
热议问题