
#Chrome browser full#
Modifying the page from the Console is possible because the Console has full access to the page's window. Using the Console to change the page's title. The Console panel next to the DevTools homepage.įigure 3. For example, Figure 2 shows the Console next to the DevTools homepage, and Figure 3 shows that same page after using the Console to change the page's title.įigure 2. You can run JavaScript in the Console to interact with the page that you're inspecting. The main difference between the methods is how they display the data that you're logging. See the Console API Reference to browse the full list of console methods. See Get Started With Logging Messages to get hands-on experience with logging. Inspecting the values of variables at a certain moment in time.Making sure that code is executing in the right order.Web developers log messages for 2 general reasons: Try to figure out which lines of code caused the browser to log the messages. querySelector ( 'h2' ), 'h2 not found!' ) įigure 1 shows what the Console looks like after loading the page and waiting 3 seconds. For example, suppose that you're in the process of writing the HTML and JavaScript for a page: Ĭonst h1 = document. When the browser executes your JavaScript and sees an expression like that, it knows that it's supposed to log the message to the Console. To log a message, you insert an expression like console.log('Hello, Console!') into your JavaScript. Web developers often log messages to the Console to make sure that their JavaScript is working as expected. The Console has 2 main uses: viewing logged messages and running JavaScript. This page explains how the Chrome DevTools Console makes it easier to develop web pages.
