javascript code to open html page code example
Example 1: how to open html file with javascript
// In my case, I used a button to activate this function:
function myFunction() {
window.location.href = 'index.html';
}
Example 2: open a html file using js
// In case I don't want any buttons or links to open a document
// I just want to open a document
window.open('file.extension');