How to have this message appear in the debugging console?

When reading this page in the Guardian I thought the slide wasn’t working, using the developper’s tool I had a look in console and found the message shown below. How do they do that ?

Hi there Corobori,

It is just a comment, and therefore hidden from the displayed page…

<!--
     __        __                      _     _      _
     \ \      / /__    __ _ _ __ ___  | |__ (_)_ __(_)_ __   __ _
      \ \ /\ / / _ \  / _` | '__/ _ \ | '_ \| | '__| | '_ \ / _` |
       \ V  V /  __/ | (_| | | |  __/ | | | | | |  | | | | | (_| |
        \_/\_/ \___|  \__,_|_|  \___| |_| |_|_|_|  |_|_| |_|\__, |
                                                            |___/
    Ever thought about joining us?
    https://workforus.theguardian.com/careers/digital-development/
--->

coothead

1 Like

Pretty simple !

Yes, a bit like me. :winky:

coothead

The comment you’re point to is the one appearing in the view source.

I think the one in the console comes from here

Hi there Corobori,

I can only presume, that it is how the browser’s “console.js” handles
the HTML comment in the head section of the document. :winky:

The “Hello” etc code does is not to be found in the document. :unhappy:

coothead

You mean the styling? That can be done with the %c directive, e.g.

console.log('%cHello.', 'font-size: 3em; color: blue;')

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.