Introduction To F12 Developer Tools
Introduction To F12 Developer Tools
F12 developer tools is a suite of tools to help you build and debug your webpage. Writing great webpages requires coding expertise, as well as the right tools to find and debug issues that will inevitably crop up. Windows Internet Explorer 9 provides a view of your rendered code, and F12 tools provides a view of how those pages are interpreted on a code level by Internet Explorer 9. F12 tools also help identify and report about elements on the page such as links and image reports.
What F12 tools do Opening F12 tools Navigating your webpage and code in F12 tools o Change attributes and variables o Search for items o Select element by click Related Topics
<html> <head> <script type="text/javascript"> function makePage() { for (var i = 1; i < 10; i++) { var myChild = document.createElement("div"); var myDiv = document.getElementById("myCount"); myChild.appendChild(document.createTextNode("Number: " + i)); myDiv.appendChild(myChild); } } </script> <title>Dynamic page sample</title> </head> <body onload="makePage();"> <h1>Dynamic page sample</h1> <div id="myCount"></div> </body> </html>
When the preceding example is rendered by Internet Explorer 9, it looks like the following screen shot. The webpage shows a series of nine "<div>" elements with text.
When you look at the source code (right-click inside the browser window, and then click View source), you only see the first "<div>" tag that was used as the parent element, but not much else.
However, when viewed in the HTML tab, you see the parent tag ("<div id="myCount">") plus additional "div" elements and text that the script added. As you are working and changing script code, press F5 to refresh and get the current DOM view.
The F12 tools are loosely broken into two areas, page and visual based tools, and code level or debugging tools. The page and visual tools are accessed mostly by using the main menu or shortcut keys. These tools complete tasks such as creating reports of all the links in your document, or visually outlining a specific element on a page. For more information on using page and visual tools, menus, and buttons, see Getting Started with the F12 Developer Tools. The code level tools are accessed through six dedicated tabs that provide HTML, CSS, and script debugging, as well as code profiling and network traffic capturing. The Consoletab offers a way to receive and view messages that you can send from within your code using the console commands. For more information, see the following topics:
Using the F12 Developer Tools Console to View Errors and Status Using Internet Explorer Developer Tools Network Capture
Many of the tools and options in F12 tools are context sensitive, that is, your options change as you change tabs. There are features that work across all tools. The following tips and tricks will help you get started working with the tools. Change attributes and variables From most views in F12 tools, you can click attributes and variables to change the values, and type in a new value. In the CSS tab, you can toggle styles and rules by selecting or clearing check boxes. Search for items You can type a specific tag, ID, element, variable, or string into the Search box and press Enter to find that item within a webpage code or details (such as under an expanded list of properties on the script tab). All found items are highlighted in the current view, and searches can be done on all but the Console tab or console view on the Script tab.. For the Network tab, if you're in the Summary view, search opens the Details view and shows search results across all categories. In the Script tab, you can also search across all the script files being used for your page, not just the one being displayed.
When you have multiple hits, you can navigate between them by pressing Enter or Shift + Enter, or click the Next or Previous result buttons.
Select element by click To make finding specific elements in a large DOM tree, you can select individual elements in the browser, and have them highlighted in the HTML tab of the F12 tools. From the F12 tools debugging window, click the Select Element by Click button , or press Ctrl + B to highlight elements on the webpage as you hover on the page. When you click a highlighted element, the HTML tab will open and scroll to the selected element in the code pane. In some situations, you might need to refresh the HTML tab to see the element.