Timvanderploeg
Timvanderploeg

Reputation: 21

HTML Href how to open a file as text

Is there a way to use <a href="test.html">test</a> but when clicked it opens the html file as a text file, like what happens when you open a css file in your browser

Upvotes: 2

Views: 1374

Answers (1)

Abdul Moeez
Abdul Moeez

Reputation: 1401

You need to use the file:/// protocol if you want to link to local files. So in your case paste file path with that three slashes.

Code Example:

<a href="file:///C:\test.html">test.html</a>
<a href="file:///C:\test.css">test.css</a>

I hope this will help you out if not, do let me know!

Upvotes: 2

Related Questions