Last active
June 20, 2020 08:10
-
-
Save jvdi/fb42aa9808684484ca1657377f8969ea to your computer and use it in GitHub Desktop.
Java script once alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use function on page Without use return | |
function once_alert() { | |
// Create variable for check alert status in browser | |
var alertset = localStorage.getItem('alertset') || ''; | |
// if value not set in browser > local storage - run alert | |
if (alertset != 'yes') { | |
// write alert message in "txt" | |
var txt = "Write once alert"; | |
alert(txt); | |
localStorage.setItem('alertset','yes'); | |
} | |
} | |
//# My Edition From : | |
//# Reference : https://stackoverflow.com/questions/24768067/display-alert-only-once |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment