

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I save HTML locally with JavaScript?
To save HTML locally with JavaScript, create an HTML file and save the following code in it. The code is for cookies in JavaScript −
<!DOCTYPE html> <html> <body> <p id="visits"></p> <script> var visits = parseInt(document.cookie.split("=")[1]); if (isNaN(visits)) visits = 0; visits++; document.cookie = "visits =" + visits; document.getElementById("visits").innerHTML = "The page ran " + timesVisited + " times."; </script> </body> </html>
Just save the above file and open in a web browser.
- Related Questions & Answers
- How to save an xtable file locally using R?
- How can I get a list of locally installed Python modules?
- How can I save new Date() in MongoDB?
- How can I escape HTML special chars in JavaScript?
- How can I delete all cookies with JavaScript?
- How can I save a HashMap to Shared Preferences in Android?
- How can I save a HashMap to Sharedpreferences in Android Kotlin?
- How can I remove a child node in HTML using JavaScript?
- How can I replace newlines with spaces in JavaScript?
- How to save HTML Canvas as an Image with canvas.toDataURL()?
- How to save DIV as Image with canvas2image with extension in HTML?
- How can I stop a video with JavaScript in Youtube?
- How can I use a label with break statement in JavaScript?
- How can I use a label with continue statement in JavaScript?
- How can I simplify the usage of Regular Expressions with JavaScript?
Advertisements