I made a request for a console to be added, so that we don't have to manually open the browser console. It got some upvotes, but no official responses.
Never fear, the console is here!
Just install the script, and it'll enable simple
console.log() calls from within Stack Snippets.
How it works
It uses the Web Messaging API to make the page and the snippet frame communicate. The script runs on both pages, setting up messaging between the two. Any
console.log calls from the snippet are caught, and forwarded to the outer page. Don't worry, they're also logged to the regular console.
- Error catching
- Better object visualizations
- Styled output
Install the script from Greasy Fork:
Should work cross-browser, provided you have a user script extension.
Tested on Chrome with Tampermonkey, and Firefox with Greasemonkey.
Bugs / Feature Requests?
Post them here.