Does inline javascript block the UI thread?

后端 未结 3 1809
感情败类
感情败类 2021-01-22 13:38

I read this nice article on how external scripts block the UI thread but it wasn\'t clear to me whether the blocking is actually due to the presence of the

3条回答
  •  情书的邮戳
    2021-01-22 14:10

    alert() or any other prompting actions will block the thread until the user responds to the prompt. No matter where they are...

    Update ( regarding the comment ) :

    A browser window parses the HTML and runs the JS with a single thread.. so anything in the javascript code that will take time to complete will block the thread.. no matter what it is.. It can be an alert or an AJAX Request or anything else..

提交回复
热议问题