Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect Chrome Inspect Element is running or not? [duplicate]

Tags:

Is there any way to detect whether the Chrome Inspect Element window is running?

For example if the user clicks "Inspect Element" in Chrome, the window shows a Hello World alert.

Is that possible?

like image 474
Mohammed Shannaq Avatar asked Sep 23 '11 10:09

Mohammed Shannaq


People also ask

How do you verify inspect element?

Just right-click and click Inspect Inspect Element, or press Command+Option+i on your Mac or F12 on your PC. In the search field, you can type anything—ANYTHING—that you want to find on this web page, and it will appear in this pane.

Is inspect element permanent?

Permanent Inspect Element. This extension lets you save the changes you make to a static web page using Inspect Element to remain there even after you refresh the page.

Can I copy code from inspect element?

You can copy by inspect element and target the div you want to copy. Just press ctrl+c and then your div will be copy and paste in your code it will run easily.

Is inspect element temporary?

When you inspect an element, you can change it temporarily. No one else is going to see the change, and you just need to refresh the page to get it back to normal.


1 Answers

UPDATE This no longer works. The property console.profiles has been removed in Chrome 29.

The only solution that's left is checking the difference between window.outerHeight and window.innerHeight as suggested by @Gerben. There is a library devtools-detect based on this method which adds devtoolschange to the window object.

Alternatively, there is an effort in progress to create a Chrome extension using a more robust detection method, see this Google Group.


Here's how they check if DevTools are open in the first challenge of Discover DevTools interactive course:

function () {     console.profile();      console.profileEnd();      if(console.clear) { console.clear() };     return console.profiles.length > 0; } 
like image 55
Dmitry Pashkevich Avatar answered Sep 30 '22 01:09

Dmitry Pashkevich