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';
}
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';
}
read html file node js
const http = require("http");
//use fs module at first to read file
const fs = require("fs");
const hostname = "127.0.0.1";
const port = 3000;
// simple code to read file using fs module
const files = fs.readFileSync("new.html");
const server = http.createServer((req, res) => {
res.statusCode = 200;
// give correct input for html
res.setHeader("Content-Type", "text/html");
res.end(files);
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
console.log("Done")
});
//simple code to make server and read file
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');
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us