Google-search – Is it possible to search in Google within JavaScript files, or the HTML markup itself

google-search

I have a bit of software that I sell (HTML / JS), that a bunch of people are stealing, simply because beyond obfuscating there's not much I can do to protect it. I've been getting quite good results by tracking these down, and either getting them to buy a license, or enforcing copyright with their hosting provider.

I'd like to get better at finding them.

What I'm doing now is searching for a couple of strings that my HTML shows in <div>s to the user. Mainly error messages. However, I can only find those instances where they haven't changed those very obvious user-viewable strings (which is a problem particularly with people that translate my app, because they find these strings and change them almost every time).

Now, my code has a number of things that'd make it very easy to identify. Names of JavaScript functions which are very unique, for example, and that no one bothers to change, and they survive minification. Also IDs and CLASSes in the HTML elements, that people that steal this code tend to not change.

Is it possible to search in Google for pages that have either a certain content in their JavaScript files, or certain ID's or Classes in their HTML?

So far the best I've found is to search in URLs, but this doesn't help me unfortunately.

Best Answer

Up until recently Googlebot didn't even capture JavaScript or CSS content. Earlier this year Googlebot started looking at JavaScript in order to render a page more like a user sitting at a browser.

Webmaster Central Blog: Understanding web pages better

But from what I understand, it's still not looking at the underlying code; just what is actually rendered to the screen.

There is, however, at least one other search engine that purports to search within code: NerdyData. I've not used it, so I can't speak to its efficacy. It's gotten a few writeups, though.