Open In App

How to access an HTML document in a browser ?

Last Updated : 01 Jun, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

HTML represents Hypertext Markup Language and is web – based scripting language. Its primary object is to make and design website pages. Records with the HTML (or HTM) augmentation just hold back text and references to different documents, similar to pictures or video.

How to access an HTML file in the browser:

  • There are a wide range of projects that you can use to make and edit a HTML file. Nonetheless, you can utilize any basic content tool to open and peruse it as text. Whenever you need to see what the website page resembles, you want to run this HTML record utilizing an internet browser.
  • Google Chrome perceives HTML, and you can utilize it to open any document with an “.html” expansion.
  • Find the HTML record you need to see, right-click on it, and pick Open with from the menu. You will see a full rundown of applications that you can use to run your document. Your default program will be at the first spot on the list.
    Select Google Chrome from the rundown, and view your record in the program.
  • Assuming Google Chrome is set as your default program, you should simply double tap the HTML document and it will naturally open in Chrome. Assuming you attempted this, and found that your PC doesn’t perceive your record, the framework will request that you utilize one of the all around introduced applications to open the document or search the web for the augmentation. Pick Open utilizing currently introduced applications. Then, at that point, have a go at picking Google Chrome from the rundown once more.
  • To ensure you opened the right HTML record, check the location bar in Chrome when it raises the page. It ought to match the area of your record on your PC.
    file:///C:/Users/VOSTRO/Desktop/GeekforGeeks/fav1.html

Example:

HTML




<!DOCTYPE html>
<html>
<head>
    <style>
        body {
            background-color: powderblue;
        }
        h1 {
            color: blue;
        }
        p {
            color: red;
        }
    </style>
</head>
<body>
    <h1>This is a heading</h1>
      
<p>This is a paragraph.</p>
  
</body>
</html>


Method 1: The file must be saved in .html format.

 

  • The HTML file opens with Default  Browser.

 

Method 2: Drag and Drop the HTML file to the Default Browser.

 

Method 3: Access an HTML File in a Browser using Notepad++

Step1: Open Notepad++ write a HTML code and save the file in HTML format.

 

Step2:

  • Go to Run Option  
  • select the browser path 

Example (If it is chrome browser)

 "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
then Add this String to browser path  "$(FULL_CURRENT_PATH)"

 The path is:

 "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"   "$(FULL_CURRENT_PATH)"
  • Then Save it And run the Program.
  • The HTML program is executed in the browser.

 



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads