Today I want to show you how the Internet Explorer Developer Tools and datajs make it easy for developers to experiment with code and data. Just follow along in another Internet Explorer window and enjoy.
First, we’ll want to start with a page, let’s say http://www.bing.com/. As always, we’re greeted with a nice background picture.
Next, we’ll bring up the developer tools. Simply press F12 in your browser and the window will come up. Pin it by pressing Ctrl+P (or clicking the rightmost button on the menu area).
Now we’ll check whether we have datajs loaded. Click on the Script tab, and type datajs at the prompt. A red message will be shown, “‘datajs’ is undefined”. OK then, let’s load it by pasting the following code at the prompt.
This pulls in datajs 0.0.3 from CodePlex. You’ll note that the tool went into multi-line mode after pasting; you can go back to the single line by clicking on the ‘Single line mode’ button. ‘Single line’ is more convenient in that you can execute everything by pressing Enter, but of course it doesn’t work well for multi-line snippets like the one above. If you run OData now, you’ll get a few of the members displayed, and we’re ready to go.
Next, if we check whether jQuery is loaded like before, we’ll see that it’s not, so the following snippet will do the trick (we’re really just changing the url value).
Now we’re ready to rock and roll. Let’s get some sample data from the web and display it on the page.
Of course, you can also use the developer tools to craft more interesting queries, submit changes, test / tweak scripts, extract and reshape some interesting page… There are lots of scenarios and uses for this very useful tool for web developers.