Xojo Web2 — Messages in DevTools (Browser’s Debugger)

Xojo Web2 — Messages in DevTools (Browser’s Debugger)

Perhaps you might have noticed that larger companies are putting their own messages in the debugging console of the web browser.

What I mean is messages like the below one from facebook.com:

It is actually easy to achieve this with Xojo Web. Add an “Opening” event to the “Session” of your Web App.

Add for instance the following code:

// string with your message
Var myMessage As String = “console.log(‘%cBetter get out of here ;-)’, ‘color: red; font-size: 30px;’)”

// Execute via a JS injection
Self.ExecuteJavaScript(myMessage)

will give you the following result in your browser’s console:

The magic is done with the “%c” in the console.log command, which only indicates that you want the following text to be formatted via CSS. You can read more about all the available options in this article: