Detecting Access Of Browser Dev Tools

Hi all,
Suppose I want to keep track of how many times my javascript is accessed/viewed by visitors to my site. What would I need to do to detect the access of my script?

I know that people use the Browser Developer Tools for viewing the scripts and the short cuts to this tool will vary depending on the browser and computer being used. Are there other methods than just using the Browser Developer Tools? Can someone please give a full list of the methods for detecting the access/viewing of javascript, thanks.

Hi @oangodd, by reading through your query I’m unsure about something… Do you want to actually detect how many users open the web developer tools, or do you want to detect how many users have Javascript enabled when they visit your site?

Once the content that you have publicly provided via a web page has been accessed, you lose all ability to track how it has been used.

For example to remain untracked, some people use wget to download a webpage which allows them to load it privately without anything being sent back to the server. The only useful information that the server can track is the access log of different files.

If you want to learn when are people snooping in to your code, you don’t have any control over that.

The only way this might be possible that I can think of is to develop a browser extension that ties in with the browsers API.

This would require a bit of development time and have little to no usefulness for what you’re interested in. How many visitors are likely to want to install a browser plugin that detects when they look at your page sources while visiting your site?

As has been posted, if you don’t want anyone to see something, don’t give it them.

Hi Andres,I would like to do many things if I can detect the access of my code. One of the things of interest to me is to record how many times my script is accessed.

That would be quite easy. You can do that via an AJAX request that calls a server script and which adds data regarding that visit into the database…

Wouldn’t that also record data when someone loads the page, but doesn’t view source or use developer tools to access the script?

I think that the OP only wants to know when someone views the scripting code.

Yeah I think I misunderstood the word ‘accessed’ here… Thanks @Paul_Wilkins

I think the idea of seeing if your code was tampered with is a good idea; something to keep in mind, only have public access to methods that you want publics.

Other hacky ideas:

  • Check window size changes, if it is instant and a large number (not multiple changes to get to the size it ends at), count that as dev tools were open.
  • Disable right click, but anyone can just use the shortcut or goto settings

Be warned with trying to stop people, for most of them will on first denial to go even greater extremes to gain access.

1 Like

I would politely suggest that you nip that irrational paranoia in the bud. :eyebrows:

If you don’t, then, before you know it, you’ll end up looking for…

       “Reds under the Bed” :shifty:

coothead

You do this through your Apache (or equivalent) logs.

You’ll have an exact count of how many times a script is downloaded. This will include normal page inclusions + simple downloads where a person is simply viewing the contents of the .js file (likely a small percentage).

Take a closer look at the OP, and you’ll find that he’s not after access information, but instead wants to know when people use dev tools to view his scripting code.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.