If you need to print a line (debugging purposes), you can use the ClientLog function. It will be displayed in the browser console (F12). I would advise to disable this kind of messages on production environments though.

However if you need to display useful information to the user, you should use a proper dialog/component (you can create a cWebModalDialog with cWebEdit/cWebHTMLBox), or even open a new tab/window.