- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Hi there,
Explanation -
Client-side debugging involves a different process and the use of different tools than what is used for server-side debugging. Below is a quick reference to some of the server-side tools that were used in the previous lesson and the ones that can be used on the client side to achieve similar functionality.
For example, Scripts - Background can be used to test and add debug statements to server-side scripts. Similarly, the JavaScript Executor can be used to test and add debug statements to client-side scripts.
Client-Side Tools
Review the following items to learn how to leverage various tools to debug client-side scripts.
Using alert() and jslog() Debug Statements
Debug statements using alert() and jslog() can be used to output log data for any client-side script running on form. Additionally, the browser developer console can be used to find and also debug any client-side script errors in the instance as was shown in the previous demo.
As stated earlier, CTRL+SHIFT+J can be used to load the JavaScript Executer, which provides an interface to run any client-side JavaScript in the browser.
JavaScript Executor using alert()
When debugging client side script, If you want your debug message to display in the browser, you can use the alert() function versus using print.log() or gs.log() as these are used only for server-side debugging.
When using alert() in a debug statement, after selecting Run my code, a dialog message appears in the browser with the output message.
JavaScript Executor using jslog()
When debugging client-side script, If you want your debug message to display in the browser console versus in a pop-up dialog box, you can use the jslog() function.
When using jslog() in a debug statement, after selecting Run my code, the output will not appear in a pop-up dialog box in the browser, instead you can view the output message from the browser console as shown.
You can access the browser console, by right-clicking in the browser interface, and selecting Inspect or by navigating to:
- Web Developer tools from Firefox
- Developer Tools from Chrome
The Browser console can also be used to:
- See error messages
- Click on source links
- Check the code for where the issue happens
If my content helped you in anyway, please mark this content as BOOKMARK, SUBSCRIBE & HELPFUL
Best Regards,
Prashant Kumar (LearnIT)
YouTube Channel LearnIT: https://www.youtube.com/@learnitwithprashant
Blog LearnIT: https://medium.com/@LearnITbyPrashant
Prashant Kumar LinkedIn: https://www.linkedin.com/in/learnitbyprashant/
ServiceNow Community Prashant Kumar - https://www.servicenow.com/community/user/viewprofilepage/user-id/19635
- 3,542 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.