It has been a ling time since i have had to code.
My situation is, i need to make a button that open an HTML file that I have located on my website. The HTML file is a interactive course that will open in a new window.
I have tried <a href="home/file.html" target="_blank"><button>launch Course</button></a>
but I get a "page not found" error.
CodePudding user response:
First of all, you don't need to combine the anchor tag with tag. In this case a tag is enough. Also, please check well the path, and verify that the HTML file is in the folder. <a href="path/to/file.html" target="_blank">/Text</a>
.
To verify that the file is accessible, and the name and the extension is correct, you can copy and paste the path in the browser to see if you can access it. Links can be absolute (the full path from the root, ex: C:/Users/path/to/folder/file.ext) or relative (the short path from the originating folder). If not, re-write the path until it works.
Tip: for security use rel="noopener noreferrer"
to prevent potential malicious attacks.
Happy coding Brandon!
CodePudding user response:
Make sure that your directory with the page you are currently on has the folder home and the html file is located within it.
<a href="home/file.html"></a>
Here's a example directory
/----------
| index.html(or the current page your on)
| home -------
| file.html