How to execute Javascript alert when page loads the first time only
html, javascript, jquery
Solution
You could use the JQuery Cookie Plugin for this.
function showPopUp() {
var cookie = $.cookie('the_cookie');
if(!cookie){
alert(" Please view this in Firefox");
$.cookie('the_cookie', 'the_value');
}
}
showPopUp();
Problem
I am trying to execute a javascript alert, but only alert if it is the first time that browser / computer has viewed that page - or something similar to that. How would this be done? I have written the Javascript to what I think it be similar to. ``` function alert() { alert(" Please view this is Firefox"); } if (first time viewing this page) { alert(); } ``` I really appreciate your help