in header does not log to console in edge browser", "text": "<p>Taking the learning to program plunge. I am not concerned about the best practice for where to insert javascript code into an HTML document. Rather please help me understand why the following code did not log to console in Edge browser.</p>\n\n<pre class="prettyprint"><code>&lt;head&gt;\n &lt;title&gt;Layout Work&lt;/title&gt;\n &lt;meta lang="en" charset="utf-8"&gt;\n &lt;link rel="stylesheet" type="text/css" href="css/normalize.css"&gt;\n &lt;link rel="stylesheet" type="text/css" href="css/style.css"&gt;\n &lt;script&gt;\n var bottles = 99;\n var beerSongPartOne = " bottles of beer on the wall!";\n var beerSongPartTwo = " bottles of beer!";\n var beerSongPartThree = "take one down pass it around";\n\n while (bottles &gt; 0) {\n console.log(bottles + beerSongPartOne);\n console.log(bottles + beerSongPartTwo);\n var bottles = bottles - 1;\n console.log(beerSongPartThree);\n console.log(bottles + beerSongPartOne);\n }\n &lt;/script&gt;\n&lt;/head&gt;\n</code></pre>", "answerCount": 1, "upvoteCount": 941, "dateCreated": "2022-10-19 17:25:15", "dateModified": "2022-10-21 07:18:11", "author": { "type": "Person", "name": "Lojik Overload" }, "acceptedAnswer": { "@type": "Answer", "text": "<p><strong>For Future Reference...</strong></p>\n\n<p>According to Microsoft, The EDGE console doesn't log messages without the console being open. This is 'by design'. You must open the console first for any output to be logged.</p>\n\n<p>I think this is a rather weird design choice, seeing as how all the other major browsers log events in the background. I would be interested to know why the developers decided this was a good idea. If anyone know feels free to chime in.</p>", "upvoteCount": 117, "url": "https://exchangetuts.com/scriptscript-in-header-does-not-log-to-console-in-edge-browser-1641406504112271#answer-1666373115962536", "dateCreated": "2022-10-19 18:18:11", "dateModified": "2022-10-21 07:18:11", "author": { "type": "Person", "name": "mattdevio" } } } }
Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<script></script> in header does not log to console in edge browser

Taking the learning to program plunge. I am not concerned about the best practice for where to insert javascript code into an HTML document. Rather please help me understand why the following code did not log to console in Edge browser.

<head>
    <title>Layout Work</title>
    <meta lang="en" charset="utf-8">
    <link rel="stylesheet" type="text/css" href="css/normalize.css">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <script>
        var bottles = 99;
        var beerSongPartOne = " bottles of beer on the wall!";
        var beerSongPartTwo = " bottles of beer!";
        var beerSongPartThree = "take one down pass it around";

        while (bottles > 0) {
        console.log(bottles + beerSongPartOne);
        console.log(bottles + beerSongPartTwo);
        var bottles = bottles - 1;
        console.log(beerSongPartThree);
        console.log(bottles + beerSongPartOne);
        }
    </script>
</head>
like image 941
Lojik Overload Avatar asked Oct 19 '22 17:10

Lojik Overload


1 Answers

For Future Reference...

According to Microsoft, The EDGE console doesn't log messages without the console being open. This is 'by design'. You must open the console first for any output to be logged.

I think this is a rather weird design choice, seeing as how all the other major browsers log events in the background. I would be interested to know why the developers decided this was a good idea. If anyone know feels free to chime in.

like image 117
mattdevio Avatar answered Oct 21 '22 07:10

mattdevio