How to search source code in Google? A major advantage of google search over other search engine is that it can find the source code of your application. This tutorial will show you how easily you can integrate source code search facility in your applications or websites.
What is source code? In any webpage, you see they are made of lines and lines of code written. There is code for webpage type, text, images, or for formatting the page. These codes can be hundreds or thousands of lines and sometimes it is difficult to search for any specific lines or codes or necessary changes that are needed to be made quickly. If you want to search for the source code in Google you need the Chrome browser and from there you can find any source code easily with details.
In this article, you can find how to easily search for source code in Google using the Google Chrome browser.
Before You Get Started
You need to ensure a few things before you start the tutorial. So please follow the instruction below for removing any interruption in this process:-
- You need to download and install the Google Chrome browser if you hadn’t. You can download it from here https://www.google.com/chrome/.
- It’s better to have some web coding basics for understanding the source code and how each line means.
Searching source code in Google
Follow the below steps for Searching source in Google Chrome:-
- First start Google Chrome and open the page you want to see the source code. You can type the webpage name in the search bar or directly search from the Google search bar from the browser. For this tutorial, I’ll search for the IMDB page and try to find its source code.
- You can position the mouse pointer over any empty space of the opened webpage now. For example from the opened IMDB page, I’m clicking the right mouse button over an empty space, and from the menus select the View page source option.
- Or you can type Ctrl+U keyboard shortcut to also access the View page source option too.
- No matter how you access the View page source option via mouse or keyboard a new tab will now open with the current page source code.
- Now from the page of source code, you can search for anything with a simple shortcut tool. Press Ctrl+F from the current source code page and then a small search box will appear in the page.
- Now from here, you can search any part of the code you want from the source code page. For example, I’m searching here “if ( window.ueLogError )” line, so I type it in the search box that appeared in step 5 then it’ll find that line from the source code window and mark it with color. In the example, it marked that line in Orange. You can also scroll between the same choices if there is more than one find.
That’s how simply you can search and find any source code from any page from google.
Summary: Search source code in Google
- Open a new tab in chrome on the device you have the source code on.
- Open the "More tools" menu by clicking on the three vertical dots in the top right of your browser.
- Click on "Save page as".
- Select the folder that contains your source code.
- Click "Save". This will save an HTML file to your computer.
- Search for "filetype:html" in google.
- Use the HTML file that you saved to search for lines of code inside of it by adding them to your search query.