- Article
- 7 minutes to read
The Console is like an intelligent, rich command line within DevTools, and is great companion tool to use with others tools. The Console provides a powerful way to script functionality, inspect the current webpage, and manipulate the current webpage using JavaScript.
The Console tool helps with several tasks, which are covered in more detail in the following articles:
- Track down problems to find out why something isn't working in the current project. See Fix JavaScript errors that are reported in the Console.
- Get information about the web project in the browser as log messages. See Filter Console messages.
- Log information in scripts for debugging purposes. See Log messages in the Console tool.
- Try JavaScript expressions live in a REPL environment. See Run JavaScript in the Console.
- Interact with the web project in the browser using JavaScript. See Interact with the DOM using the Console.
You can open the Console tool in the top or bottom of DevTools; it's shown here in upper part, on the main toolbar:
The Console is shown here in the lower part of DevTools (the Drawer), with the Elements tool open above it:
The fastest way to directly open the Console is to press Ctrl
+Shift
+J
(Windows, Linux) or Command
+Option
+J
(macOS).
Error reports and the Console
The Console is the default place where JavaScript and connectivity errors are reported. If any errors occur, the Issues counter is displayed next to the Settings icon in DevTools that provides the number of errors and warnings. Click the Issues counter to open the Issues tool and display the problem. For more information, see Fixing JavaScript errors that are reported in the Console.
DevTools gives detailed information about the error in the Console:
Search the web for a Console error message string
Search the web for your Console error messages, right from within DevTools. In the Console, many error messages have a Search for this message on the Web button, shown as a magnifying glass:
When you click the Search for this message on the Web button, a new tab opens in the browser and shows search results for the error message:
Inspect and filter information on the current webpage
When you open DevTools on a webpage, there may be an overwhelming amount of information in the Console. The amount of information becomes a problem when you need to identify important information. To view the important information that needs action, use the Issues tool in DevTools.
Issues are gradually being moved from the Console to the Issues tool. However, there's still a lot of information in the Console, which is why it's a good idea to know about the automated log and filter options in the Console. For more information, see Filter Console messages.
DevTools with a Console full of messages:
Log information to display in the Console
The most popular use case for the Console is logging information from your scripts using the console.log()
method or other similar methods.
Example code
// prints the text to the console as a log messageconsole.log('This is a log message');// prints the text to the console as an informational messageconsole.info('This is some information'); // prints the text to the console as an error messageconsole.error('This is an error');// prints the text to the console as a warningconsole.warn('This is a warning');// prints the geometry of the document body as an objectconsole.log(document.body.getBoundingClientRect());// prints the geometry of the document body as a tableconsole.table(document.body.getBoundingClientRect());// shows a list of techologies as a collapsed grouplet technologies = ["HTML", "CSS", "SVG", "ECMAScript"];console.groupCollapsed('Technolgies');technologies.forEach(tech => {console.info(tech);})console.groupEnd('Technolgies');
To log information to display in the Console:
Open the demo webpage Console messages examples: log, info, error and warn in a new window or tab.
To open the Console, press
Ctrl
+Shift
+J
(Windows, Linux) orCommand
+Option
+J
(macOS).The Console displays the resulting messages that are caused by the demo code:
Paste the above code into the Console, and then press
Enter
.If you get a message:
Uncaught SyntaxError: Identifier 'technologies' has already been declared
:(Video) Microsoft Edge | What's New in DevTools 101Open a new tab or window.
To open the Console, press
Ctrl
+Shift
+J
(Windows, Linux) orCommand
+Option
+J
(macOS).Paste the above code into the Console, and then press
Enter
.
Many useful methods are available when you work with the Console. For more information, see Log messages in the Console tool.
Try your JavaScript live in the Console
The Console isn't only a place to log information. The Console is a REPL environment. When you write any JavaScript in the Console, the code runs immediately. You may find it useful to test some new JavaScript features or to do some quick calculations. Also, you get all of the features you expect from a modern editing environment, such as autocompletion, syntax highlighting, and history.
To try running JavaScript in the Console:
Open the Console.
Type
2+2
.
The Console displays the result of 2+2
live as you type it, displaying the result 4
on the following line:
This Eager evaluation feature is useful to debug and verify that you aren't making mistakes in your code.
To run the JavaScript expression in the Console and optionally display a result, press Enter
. Then, you can write the next JavaScript code to run in the Console.
Running several lines of JavaScript code in succession:
By default, you run JavaScript code on a single line. To run a line, type your JavaScript and then press Enter
. To work around the single-line limitation, press Shift
+Enter
instead of Enter
.
Similar to other command-line experiences, to access your previous JavaScript commands, press Arrow-Up
. The autocompletion feature of the Console is a great way to learn about unfamiliar methods.
To try autocompletion:
- Open the Console.
- Type
doc
. - Select
document
from the dropdown menu. - Press
Tab
to selectdocument
. - Type
.bo
. - Press
Tab
to selectdocument.body
. - Type another
.
to display the complete list of properties and methods available on the body of the current webpage.
For more information about all the ways to work with Console, see Console as a JavaScript environment.
Autocompletion of JavaScript expressions in the Console:
Interact with the current webpage in the browser
The Console has access to the Window object of the browser. You can write scripts that interact with the current webpage, by reading data from the DOM and assigning data to DOM elements.
Reading from the DOM tree in the Console
To use a JavaScript expression to read from the current page by reading a selected element from the DOM tree:
Open the Console.
Paste the following code into the Console, and then press
Enter
:document.querySelector('h1').innerHTML
This expression selects the first heading-level 1 from the DOM and then selects the HTML content that's contained between the
<h1>
start and end tags. The Console displays the output of the expression, which is the text of the heading:
You have read from the DOM representation of the webpage, by entering a JavaScript expression in the Console and displaying the output in the Console.
Writing to the DOM tree and webpage from the Console
You can also change the rendered webpage, by changing the DOM (or writing to the DOM), from within the Console.
To change the rendered webpage:
Open the Console.
Paste the following code into the Console, and then press
Enter
:document.querySelector('h1').innerHTML = 'Rocking the Console';
The above JavaScript expression uses the
=
sign to assign a value to the selected DOM item. The evaluated value of the expression is a string for a heading, in this example. The expression's value (the heading string) is shown both in the Console and in the rendered webpage:You changed the main heading of the webpage to Rocking the Console.
Using the $$ Console utility method to
The Console Utility methods make it easy to access and manipulate the current webpage.
For example, to add a green border around all the links in the current webpage:
Open the Console.
Paste the following code into the Console, and then press
Enter
:$$('a').forEach(a => a.style.border='1px solid lime');
The
$$(selector)
console utility function is "Query selector all". This DOM query selector function returns an array of all the elements that match the specified CSS selector, like the JavaScript functiondocument.querySelectorAll()
. In this example, we select all the<a>
hyperlink elements and then apply a green box around them:
For more information, see Console tool utility functions and selectors.
See also
- Interact with the DOM using the Console.
- Console features reference
- Console object API Reference
- Console tool utility functions and selectors
FAQs
How do I open the developer Console in Edge? ›
To open the Console, press Ctrl + Shift + J (Windows, Linux) or Command + Option + J (macOS).
What is the overview of Microsoft Edge? ›Microsoft Edge is the browser created for Windows 10; Edge replaces Internet Explorer (IE), the browser that debuted with Windows 95 and was a part of Windows operating systems for the following two decades. Edge is a smaller, more streamlined browser built on Web standards and designed for Web services.
How do I use Microsoft Edge Developer Tools? ›- Open the browser.
- Press F12 on the keyboard. Optional: Press Ctrl+Shift+I keys or click the Setting and more ellipsis icon, then click More tools > Developer Tools.
The Microsoft Edge browser comes with built-in web development tools, called Microsoft Edge DevTools. DevTools is a set of web development tools that appears next to a rendered webpage in the browser. DevTools provides a powerful way to inspect and debug webpages and web apps.
How do I pull up the developer console? ›To open the developer console in Google Chrome, open the Chrome Menu in the upper-right-hand corner of the browser window and select More Tools > Developer Tools. You can also use Option + ⌘ + J (on macOS), or Shift + CTRL + J (on Windows/Linux).
How do I open my browser developer console? ›- Keyboard: Ctrl + Shift + I , except. Internet Explorer and Edge: F12. ...
- Menu bar: Firefox: Menu. ...
- Context menu: Press-and-hold/right-click an item on a webpage (Ctrl-click on the Mac), and choose Inspect Element from the context menu that appears.
The benefits of switching to Chromium — Since the new Chromium Edge will be based off the same browser as Google Chrome, Edge will now support all the same extensions.
What makes Microsoft Edge unique? ›Its helpfully customizable home page, speed, Collections feature, built-in screenshot tool, stackable tabs, and progressive web app support are just a few of the browser's appealing features. Edge is the default web browser in Windows 11, and there are some Microsoft-specific links that only it can load.
What is so special about Microsoft Edge? ›Microsoft Edge has built in tools like Collections, vertical tabs and tab groups that help you stay organized and make the most of your time online. Microsoft Edge is the best browser for shopping with built-in tools like coupons, price comparison, price history, and cash back.
How do I debug HTML code in edge browser? ›- To open DevTools, right-click the webpage, and then select Inspect. Or, press Ctrl + Shift + I (Windows, Linux) or Command + Option + I (macOS). DevTools opens.
- Select the Sources tool. Select the Page tab, and then select the JavaScript file, get-started. js .
How to use Microsoft Edge Developer Tools for Visual Studio Code? ›
- Step 1: Install the Microsoft Edge Browser. ...
- Step 2: Install the Microsoft Edge Tools Extension. ...
- Step 3: Choose Full-browser or Headless Mode and Enable the Network Panel. ...
- Step 4: Connect MS Edge to your Web Application.
The Microsoft Edge DevTools extension for Visual Studio Code lets you use Microsoft Edge DevTools and an embedded version of the Microsoft Edge Browser including Device Emulation, right from within Visual Studio Code.
What programming language does Microsoft Edge use? ›Preview release(s) [±] | |
---|---|
Written in | C++ |
Engines | Android: Blink iOS/iPadOS: WebKit macOS: Blink Microsoft Windows: EdgeHTML (2014–2019) Blink (2019–present) Linux: Blink Xbox One: EdgeHTML (until 2021) Blink (from 2021) Xbox Series X/S: EdgeHTML (until 2021) Blink (from 2021) |
If you're used to Chrome's developer tools, Edge's tools are nearly identical. Edge even has some additional features like popular light and dark color themes, including Solarized, Monokai, and others.
Does Edge have Java built in? ›Internet Explorer 11 and Firefox will continue to run Java on Windows 10. The Edge browser does not support plug-ins and therefore will not run Java.
What is developer console in browser? ›The browser developer tools console is one of the most powerful tools available to you when it comes to debugging your front-end web applications. The console has an API that provides several methods that make debugging easier. It's not uncommon to see developers using console. log() or console.
What is the dev console? ›What Is the Developer Console? The Developer Console is an integrated development environment (more typically called an IDE) where you can create, debug, and test apps in your org. It's your one-stop solution for a variety of development tasks.
How do I view the developer menu? ›- On the File tab, go to Options > Customize Ribbon.
- Under Customize the Ribbon and under Main Tabs, select the Developer check box.
- Windows/Linux: Press Control + Shift + J.
- Mac: Press Command + Option + J.
Support for the legacy version of the Microsoft Edge desktop app ended on March 9, 2021. The Microsoft Edge Legacy application will no longer receive security updates after that date. Go here to learn more.
Is there a better browser than Edge? ›
If you're worried about how Google uses your data, Safari or Microsoft Edge may be your better alternative. Still, despite privacy concerns, Chrome is a great browser overall if you use Google's services. It's probably the ideal default browser if you shift between Windows, Android, and Apple devices.
Is there a better browser than Microsoft Edge? ›Another venerable browser and popular alternative, the Opera browser shares much of Chrome's DNA and deserves its place as one of the best web browsers. Like both Edge and Chrome, Opera is built on Google's open-source Chromium engine and, as a result, they all have a very similar user experience.
What are the main parts of Microsoft Edge? ›- More modern, lightweight, and reduced resource consumption.
- Support for "inking" or the ability to write on a web page.
- Support for Firefox and Chrome add-ons.
- Faster page rendering.
- Integration with Cortana.
- Automatic form fill, or autofill.
- Private browsing.
- More security features.
- No history search.
- Small number of sites don't work.
- Fewer extensions than competitors.
Edge was created to support complex software applications and websites. Today's web applications are complex and work on Componentization. The web components bring together the independent isolations of HTML, CSS, and JavaScript.
Is Microsoft Edge faster than Google? ›Speed and memory
Both of these browsers fare well in the speed category, but most testing sites have shown Edge to be faster than Chrome. If you tend to open a lot of tabs, Edge has been shown to use less memory per tab than Chrome in all of the tests that I've seen, so this can be a big advantage.
Businesses use edge computing to improve the response times of their remote devices and to get richer, more timely insights from device data.
Does Edge have ActiveX? ›No, Microsoft Edge doesn't support ActiveX controls and Browser Helper Objects (BHOs) like Silverlight or Java. If you're running web apps that use ActiveX controls, x-ua-compatible headers, or legacy document modes, you need to keep running them in Internet Explorer 11.
Does Edge have telemetry? ›Built in to every network node, Edge telemetry provides deep insight into the performance of the network at all levels, making the data explorable and actionable.
How do I edit JavaScript in edge? ›- Select the Sources tool.
- In the Navigator pane, select your file, to open it in the Editor pane.
- In the Editor pane, edit your file.
- Press Ctrl + S (Windows, Linux) or Command + S (macOS) to save. DevTools then loads the JavaScript file into the JavaScript engine of Microsoft Edge.
How do I enable JavaScript in edge browser? ›
- Click the "Settings and more" button. In the top right hand corner of your Edge browser's window, you will see a small button with 3 dots in it. ...
- Select the "Settings" menu item. ...
- Search for "Javascript" ...
- Find the "JavaScript" section. ...
- Choose your preferred JavaScript settings. ...
- Close the settings tab.
Microsoft Edge Developers Tools for Visual Studio (PREVIEW) A Visual Studio extension that allows you to preview your ASP.NET, and ASP.NET Core projects, inside of Visual Studio. In addition to seeing a preview of your web app, you can use the Edge Developer Tools Elements tool to modify CSS.
Does VBA work with Microsoft Edge? ›If you want to automate Edge through VBA, you need to use SeleniumBasic. SeleniumBasic is a Selenium based browser automation framework for VB.Net, VBA and VBScript. You can follow the steps below to automate Edge browser with SeleniumBasic: Download the latest version of SeleniumBasic v2.
Where is the source code in Edge? ›Open the Microsoft Edge page you want to inspect
Open the specific Microsoft Edge page you want to inspect the code for. Click "Control" + "U" on the keyboard. You can also right-click on a blank portion of the page and click "View page source" on the menu.
Developer tools (or "development tools" or short "DevTools") are programs that allow a developer to create, test and debug software. Current browsers provide integrated developer tools, which allow to inspect a website.
How to debug Angular code in Edge browser? ›- Step 1: Open Browser DevTools;
- Step 2: Open Console Tab;
- Step 3: Open Source Code with Issues;
- Step 4: Make Break Points and Debug;
F12 tools provide a set of tools that you can use to design, debug, or view webpage source code and behavior. F12 tools can be opened in a separate window or pinned to the bottom of the webpage that you're debugging.
Is Microsoft Edge HTML? ›In 2018, Microsoft began rebuilding Edge as a Chromium-based browser, which meant that EdgeHTML would no longer be used in the Edge browser. This transition was completed in April 2021. Past this date, EdgeHTML does, however, continue to be supported and widely used in Universal Windows Platform apps.
Does Edge run JavaScript? ›JavaScript is supported in the Microsoft Edge web browser. However, it might have been disabled in your browser by an administrative setting. If you encounter a JavaScript error in Edge: On the More menu (...), select Open with Internet Explorer.
Which JavaScript engine does Edge use? ›Edge was the default browser for Windows 10. It was built with Microsoft's browser engine EdgeHTML and their Chakra JavaScript engine.
Is Edge built off of Chromium? ›
In January 2020, Microsoft Edge made a major change and moved away from Microsoft's framework in favor of the Chromium platform.
Which browser has best DevTools? ›- One of the best browsers in terms of feature compatibility;
- High popularity, huge user community;
- Integration with the Google ecosystem;
- Industry standard with a huge number of extensions;
- Excellent DevTools.
The new Microsoft Edge (Chromium) is built on the same underlying technology as Google Chrome, offering world class performance and compatibility with your favorite websites and extensions.
Why did browsers stop supporting Java? ›The reason for dropping the support was because of security issues and risks that were found. But there is Internet Explorer that still has the support for Java Applet. So, today Internet Explorer is the only browser that supports Java Applet.
What rendering engine does Edge use? ›So what does Microsoft Edge use? Microsoft, in true maverick fashion, built its Edge browser with its own EdgeHTML browser engine and Chakra JavaScript Engine. With the Edge 79 release, Microsoft is switching to Blink browser engine with V8 JavaScript engine.
What is F12 in Microsoft Edge? ›Press this key | To do this |
---|---|
F12 | Open Developer Tools (toggle) |
ESC (in full-screen mode) | Exit full-screen mode |
ESC | Stop loading page; close dialog or pop-up |
Space | Scroll down webpage, one screen at a time |
From the Visual Studio toolbar on the top, click on the debug menu, on the arrow close to the name of the project. For debugging purposes, I use the Edge Developer, but this trick works with the other versions as well. As arguments, you can set: "--auto-open-devtools-for-tabs". Click Ok and save.
How do I enable developer menu? ›...
Enable Developer options
- On your device, find the Build number option. ...
- Tap the Build Number option seven times until you see the message You are now a developer!
To open F12 tools, press "F12" from the webpage you want to debug or inspect. To close F12 tools, press "F12" again.
What is F1 F2 F3 F4 f5 F6 F7 F8 f9 f10? ›The function keys or F-keys on a computer keyboard, labeled F1 through F12, are keys that have a special function defined by the operating system, or by a currently running program.
What is the developer key for edge? ›
You can open Microsoft Edge Developer Tools (DevTools) by pressing the F12 key or by pressing the Ctrl + Shift + i keys. The Microsoft Edge Developer Tools are a set of tools built directly into the Microsoft Edge browser.
How do I debug JavaScript in Microsoft Edge? ›- To open DevTools, right-click the webpage, and then select Inspect. Or, press Ctrl + Shift + I (Windows, Linux) or Command + Option + I (macOS). DevTools opens.
- Select the Sources tool. Select the Page tab, and then select the JavaScript file, get-started. js .
If you're used to Chrome's developer tools, Edge's tools are nearly identical. Edge even has some additional features like popular light and dark color themes, including Solarized, Monokai, and others.
How do I open Advanced settings in edge? ›Click More button. Select Settings. Scroll down to Advanced settings. Click View Advanced settings.
Where we can see your code in dev tool? ›Access Developer Tools
Right-click a page and select "Inspect Element". This displays the HTML code for the element you clicked. Select View > Developer > Developer tools.
What Is the Developer Console? The Developer Console is an integrated development environment (more typically called an IDE) where you can create, debug, and test apps in your org. It's your one-stop solution for a variety of development tasks.
Why is developer option hidden? ›By default, the developer options in Android phones are hidden. This is because they're designed for use by developers who want to test various functionalities and make changes that may impact the phone's performance.
What can you do in developer mode? ›- Stay Awake. With this option enabled, your phone's screen will stay on when plugged into a charger. ...
- OEM Unlocking. 2 Images. ...
- Running Services. 2 Images. ...
- USB Debugging. 2 Images. ...
- Feature Flags. 2 Images. ...
- Force Peak Refresh Rate. ...
- Mobile Data Always Active. ...
- Default USB Configuration.
You may open the Edge browser console by clicking on F12 Developer Tools in the dropdown menu, or by pressing F12. You can also right-click on any element of the web page and select Inspect Element. The IE development console can be opened in the same way as the Edge console.
How do I inspect element in Microsoft edge? ›Inspect Elements in Microsoft Edge
There are two ways to enable inspection: Go to the address bar and enter about:flags. In the dialog box, select the Show View Source and Inspect Element in the context menu checkbox. Press F12, then select DOM Explorer.
What is developer tools in browser? ›
Developer tools (or "development tools" or short "DevTools") are programs that allow a developer to create, test and debug software. Current browsers provide integrated developer tools, which allow to inspect a website.