`

犀牛书第五版读书笔记——Chapter 13. JavaScript in Web Browsers(第二部分)

阅读更多
12.当有多个onload事件处理函数注册,浏览器会调用所有的处理函数,但是调用的顺序则无从保证

13.文档解析已经完成之后绝对不能调用document.write()方法。这样做的话,将创建一个新的document,并覆盖掉现有的document,用户甚至没有机会看到现有的document

14.javascript是单线程的。因此两个事件处理函数绝对不会同时执行

15.单线程也带来一些问题:它意味着javascript代码不能执行太长时间。如果javascript代码执行太久,会延迟document的载入,用户直到代码执行完成之间,都看不到页面。如果事件处理函数执行太久,则执行期间浏览器会停止响应,用户可能会认为网页已经崩溃了

16.一般来说,不推荐在文档解析过程中,对文档内容进行操作。经验丰富的javascript程序员通常采用的做法,是在文档解析完成后,再对文档进行操作。否则可能会出现一些奇怪的问题

17.javascript程序一个不能回避的问题,就是跨浏览器兼容性

18.网页过多地依赖javascript代码,可能会带来可访问性的问题。比如有的用户使用的是移动设备,和声音阅读器之类的,要注意这种情况。当然,在国内这种情况似乎不多

19.为了安全性的考虑,客户端javascript有意屏蔽了很多功能,比如删除文件,创建网络socket等,因为这些功能可以被恶意javascript代码用来做一些危险的事,损害用户的安全

20.javascript一般遵循“同源策略”,来保证安全性,不同的浏览器对同源策略的实现也不一样
分享到:
评论

相关推荐

    HTML5 and JavaScript Web Apps【PDF新书】

    Chapter 2. The Mobile Web Chapter 3. Building for the Mobile Web Chapter 4. The Desktop Web Chapter 5. WebSockets Chapter 6. Optimizing with Web Storage Chapter 7. Geolocation Chapter 8. Device ...

    JavaScript权威指南(第6版).JavaScript:The.Definitive.Guide

    Chapter 13 JavaScript in Web Browsers Chapter 14 The Window Object Chapter 15 Scripting Documents Chapter 16 Scripting CSS Chapter 17 Handling Events Chapter 18 Scripted HTTP Chapter 19 The jQuery ...

    JavaScript权威指南第五版【新】(犀牛书)

    这本最畅销的JavaScript参考书的第四版已经进行了全面的更新,其中涵盖JavaScript 1.5(ECMAScript Version 3)的详细介绍。它还提供了W3C DOM标准(1级和2级)的完整内容,为了向后兼容,本书保持了遗留的O级DOM的资料...

    [removed] Moving to ES2015 (AZW3格式)

    Chapter 2. Functions, Closures, And Modules Chapter 3. Data Structures And Manipulation Chapter 4. Object-Oriented Javascript Chapter 5. Javascript Patterns Chapter 6. Testing And Debugging Chapter 7....

    Beginning.JavaScript.5th.Edition

    Beginning JavaScript, 5th Edition shows you how to work effectively with JavaScript frameworks, functions, and modern browsers, and teaches more effective coding practices using HTML5. This new ...

    Mastering.JavaScript.High.Performance.1784397296

    Build faster and more proficient JavaScript programs for web browsers and hybrid mobile apps Step-by-step tutorial stuffed with real-world examples Who This Book Is For If you are a JavaScript ...

    JavaScript权威指南(第6版)

    Chapter 13 JavaScript in Web Browsers Chapter 14 The Window Object Chapter 15 Scripting Documents Chapter 16 Scripting CSS Chapter 17 Handling Events Chapter 18 Scripted HTTP Chapter 19 The jQuery ...

    Professional JavaScript for Web Developers英文版

    the-fly graphicsJavaScript API changes in HTML5how browsers handle JavaScript errors and error handlingfeatures of JavaScript used to read and manipulate XML datathe JSON data format as an alternative...

    javascript权威指南(第六版)

    13. JavaScript in Web Browsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 13.1 Client-Side JavaScript 307 13.2 Embedding JavaScript in HTML 311 13.3 ...

    Mastering.JavaScript.1785281348

    The majority of websites employ JavaScript, and it is well supported by all modern web browsers without plugins. However, the JavaScript landscape has changed dramatically in recent years, and you ...

    Professional Mobile Web Development with WordPress, Joomla! and Drupal.pdf

    CHAPTER 2 A Technical Overview of the Mobile Web . . . . . . . . . . . . . . . . . . . . . . . . . 15 CHAPTER 3 Keeping Abreast of Developments . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

    Jump Start HTML5

    Chapter 2. Basics: The Anatomy of HTML5 Chapter 3. Basics: Structuring Documents Chapter 4. Basics: HTML5 Forms Chapter 5. Basics: Multimedia, Audio and Video Chapter 6. Multimedia: Preparing Your ...

    Web Browsers

    ### Web Browsers:互联网探索之门 #### 一、引言 随着互联网技术的迅猛发展,Web浏览器成为了人们日常生活中不可或缺的一部分。它不仅为用户提供了一种便捷的方式访问万维网,同时也是连接全球信息的重要工具。...

    SignalR Programming in Microsoft ASP.NET

    Use the simple ASP.NET API in SignalR for creating server-to-client remote procedure calls (RPC) that call JavaScript functions in client browsers from server-side .NET code. Exploit the API for ...

    Web Applications with Javascript or Java, Volume 1-De Gruyter(2018).pdf

    This two-volume book shows how to design and implement web applications with a model-based engineering approach, using the two most relevant technology plat- forms for web development: JavaScript and ...

Global site tag (gtag.js) - Google Analytics