Show alert if console is not available in Browser


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. if(typeof window.console === 'undefined') {
  2. window.console = {
  3. log : function(str) {
  4. alert(str);
  5. }
  6. }
  7. }
  8.  
  9. // mehr JS Code...
  10. console.log("I am an alert? Then console is not available");
  11. alert("I am just a simple alert");

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.