|
Copy HTML source code to the clipboard in Google Chrome |
|
Facts -
HTML and Javascript
|
|
Friday, 23 July 2010 19:45 |
|
This note is for Google Chrome 5.0.
In many browsers such as Internet Explorer 7 and 8 and Firefox 3.x it is easy to view the HTML source code of a web page. Even so if the page has been generated from a request to a server with a parameter or by javascript code. Usually the way to view the HTML source is simply right click on the page and select View page. Or select View frame if you want to see the html code of an iframe. Usually a new browser tab will appear with the HTML source. From there the HTML source code can be selected and copied to the clipboard, e.g. with Ctrl-C on Windows.
With Google Chrome there are two different ways to view the HTML source of a web page. The first way is select Save page as from the menu and then choose the format Web page, complete. To copy the HTML code to the clipboard you have to load the saved file into an editor.
Alternatively right click on the page and select Inspect element. A new window pops up with the HTML DOM tree. Select the highest DOM node html and right click on it. Then choose Copy as HTML to copy the HTML code to the clipboard.
|