Web Hacks

Show console warning message like Facebook without source of log lines

Hello guys, in this web hack I will show you how to  show console warning message like Facebook without source of log lines. Facebook in previous few years has work a lot for improving security in their network. Currently on one can beat Facebook social network in any way. Recently Facebook developers block developer console tools to prevent copy and paste scripts in it. But with the browser updates console block is remove on every website. You cannot block anything in console now if you are running a latest version browsers. But however Facebook show’s a warning message to alert users what they will face if they use console panel.

Console Warning Message

In above image you can see a warning but you can not see source of log from where it is generate.

Steps to create console warning message like Facebook

//Without console log source
setTimeout(console.log.bind(console, '\n%c' + "Stop ! ", "font-weight:bold; font: 6em Arial; color: red; "));
setTimeout(console.log.bind(console, '\n%c' + "Message without log source", "font-weight:bold; font: 2em Arial; color: black; ")); 

//With console log source
console.log("%cStop!", "font-weight:bold; font: 6em Arial; color: red; ");
console.log("%cMessage with log source", "font-weight:bold; font: 2em Arial;  ");
  1. Create any file with extension .html then copy and paste this code in that file.
  2. Open this file in any browser then open developer tools using Ctrl + Shift + I keys.
  3. Click on console tab then you will see 4 console warning messages as shown below

Warning Message

In above image, you can see that Message with log source comes first and then Message without log source. This is so because we set a timeout function which take more time to run.

So, now you can see the difference between console messages without log source and messages with log source. On right side of Messages with log source you can see test.html:7  which means this message is generated on line 7 of test.html file. So, anyone can view this source of log but you can hide it using our second method.

However, Facebook is not using any of these method because no one knows the actual working of this console warning. There are lot of websites providing Facebook console warning code but all are actually fake. This is just a example how you can show console warning message just like Facebook but not exactly like Facebook.


Anil Mehra

I am Anil Mehra, a passionate, workaholic and a Full Stack Tech Savvy Programmer with true north towards growth. I have worked on 256 live projects in MNC. I am expertise in the field of Programming, Server Management, SEO, Blogging and SMO...

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button

Adblock Detected

Please turn off Ad blocker to view website