+ 6
How is this possible???
We know that only information which is provided in the meta tag is displayed on the webpage but I don't understand that when I wrote "hi" in head tag, it displayed on the webpage. Why? https://code.sololearn.com/W28YxPjKJCRJ/?ref=app
7 odpowiedzi
+ 5
visph
The question is why is "hi" render when it was written in the head of the HTML document.
The answer is "Browsers fix any invalid content and go on" according to the site "How Browsers Work: Behind the scenes of modern web browsers" see link in my previous post.
The code I linked is related to this post in that I wanted to give an exaggerated example. So I copied Divyanshu Singh code and misaligned the tags to go along with the site I referenced to, again see my previous post for the link. The point was to show how the browser will correct the programmer's mistakes.
This is not a Sololearn Playground issue it is the browser doing what it is programmed to do.
But you are right in that I should have logged out the HTML document to make the point clearer. Which I have now done.
https://code.sololearn.com/WVuGfVfzX2Cc/#js
+ 4
Browsers' error tolerance
"You never get an "Invalid Syntax" error on an HTML page. Browsers fix any invalid content and go on."
source:
'How Browsers Work: Behind the scenes of modern web browsers'
https://www.html5rocks.com/en/tutorials/internals/howbrowserswork/#Browsers_error_tolerance
https://code.sololearn.com/WVuGfVfzX2Cc/#html
+ 4
The playground does have some drawbacks, but this isn't one of the.
And depending on what device you are using they are different.
But that is for a different post.😉
Yeah, HTML most definitely a free and relax markup language.😜
+ 2
I thought sololearn's playground has some drawbacks ODLNT
+ 2
Thanks for explaining this ODLNT .
+ 1
Divyanshu Singh:
put this snippet in the js tab, and see how the html engine has closed the <head> element prematurly (document.documentElement refer to the root <html> element, <style> and <script> tags are added by playground at end of <head> BEFORE html engine parse the html source):
onload = function () {
alert(document.documentElement.innerHTML);
};
ODLNT: why linking a code not related with the OP question?
0
That means HTML is not so strong like Python, C++, etc.