lundi 30 avril 2018

Firefox vs Chrome JavaScript interpreter differences and similarities

<html>
<body bgcolor="WHITE">
    <p>Paragraph 1</p>
    <script type="text/javascript">
        //Script block 1
        alert("Fisrt Script Block");
    </script>
    <p>Paragraph 2</p>
    <script type="text/javascript">
        //Script block 2
        alert("Second Script Block");
    </script>
    <p>Paragraph 3</p>
</body>
</html>

I saved this html file and then executed it in Firefox and Chrome.

On running the code in chrome, the alert boxes(both of them) popped out first and then the paragraph content was displayed. Whereas, in Firefox, first, the content in the paragraph tag gets loaded, followed by the first alert, followed by second para, followed by second alert, and after clicking the OK button, the 3rd para content is displayed.
As far as my knowledge is concerned, this difference is due to the difference in the interpreters as used by Firefox and Chrome, and that I am sure of.

My question is, what is this behavior called? I mean the behavior of having their own interpreters, is it termed something?

Any help will be appreciated. Thanks!




Aucun commentaire:

Enregistrer un commentaire