Skip to main content
Participant
Jun 29, 2021 3:11 PM UTC
Question

console.log("Hello World");

I tried to write the script tag console.log ("Hello World") in DreamWeaver CC 2021, but didn't work. Appeared the follow message:  ERROR: Unexpected console statement. [no-console]. Why is this happened?

    This topic is closed to new replies. Start a new post to keep the conversation going.

    8 replies

    BenPleysier
    Community Expert
    Community Expert
    Jun 29, 2021 10:08 PM UTC

    Try the following:

     
    HTML:
    <!doctype html>
    <html>
    
    <head>
        <meta name="ac:base" content="/test-php">
        <base href="/test-php/">
        <meta charset="UTF-8">
        <title>Untitled Document</title>
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    </head>
    
    <body id="index">
    
    
        <script src="myjs.js"></script>
    </body>
    
    </html>

     

    The Javascript file called `myjs.js`:

    console.log("Hello World")

     

    Then view the file with the console tab selected and see

     

    Translate
    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
    B i r n o u
    Legend
    Jun 29, 2021 8:35 PM UTC

    yes you're right, the console object use to work in Dreamweaver, but as soon as the chrome engine become editable in live view, I think that the team remove this feature.

    it was displaying the output in  the result panel (Site Report) as you can see in this tutorial

    https://www.linkedin.com/learning/l-essentiel-de-dreamweaver-cc-2013-5-flux-de-donnees-et-interactivite/utiliser-la-console-integree

     

    Translate
    Participant
    Jun 29, 2021 8:55 PM UTC

    Thank you, osgood_ ! Thank you, Nancy OShea! Thank you, Birnou! The Adobe's coder said to me, in the chat, that console is a global, not a universal, 'cause this doesn't works in DreamWeaver.

    Translate
    Legend
    Jun 29, 2021 6:00 PM UTC

    console.log() is what is output to the 'browser' console and can be viewed by using the browser devtools or does DW have its own terminal window where you are trying to output javascript code?

    Translate
    Participant
    Jun 29, 2021 6:41 PM UTC

    os good_

     

    I think so. But I Am begginer in JavaScript, and all the tutorials that I've read teach that I must to write this tag all the time, in the code. How must I run the code, in Preview in Browser?

    Translate
    Nancy OShea
    Community Expert
    Community Expert
    Jun 29, 2021 6:59 PM UTC

    Dreamweaver is first & foremost an HTML code editor. 

    Start with an HTML document.  Go to File > New > HTML > hit the Create button.

    Add JavaScript between the <script> tags inside your HTML document.

    Use Ctrl/Cmd + S to save.

    Preview in your favorite browser (F12).

     

    Example:

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>JavaScript Test</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <body>
    <h1>Heading 1</h1>
    <h2>Heading 2</h2>
    <p>Lorem ipsum dolor...</p>
    <hr>
    <script>
     alert( 'Hello, world!' );
    </script>
    </body>
    </html>

     

    Hope that helps.  🙂

     

    Translate
    Nancy O'Shea— Product User & Community Expert