在好例子网,分享、交流、成长!
您当前所在位置:首页js 开发实例高级JavaScript组件 → Third-Party JavaScript(2013)

Third-Party JavaScript(2013)

高级JavaScript组件

下载此实例
  • 开发语言:js
  • 实例大小:8.21M
  • 下载次数:5
  • 浏览次数:17
  • 发布时间:2022-08-31
  • 实例类别:高级JavaScript组件
  • 发 布 人:ZSPINGGG
  • 文件格式:.pdf
  • 所需积分:2
 相关标签: Javascript Javascrip script java java

实例介绍

【实例简介】Third-Party JavaScript(2013)

【实例截图】

【核心代码】

contents
foreword
xii
preface
xv
acknowledgments
xvii
about this book
xix
about the authors
xxii
about the cover illustration
xxiii
1
Introduction to third-party JavaScript
1
1.1
Defining third-party JavaScript 2
1.2
The many uses of third-party JavaScript 4
Embedded widgets
6
Analytics and metrics
8
Web service API wrappers
10
1.3
Developing a bare-bones widget
13
Server-side JavaScript generation
14
Distributing widgets as
iframes
16
1.4
Challenges of third-party development
17
Unknown context
17
Shared environment
18
Browser restrictions
19
1.5
Summary
20
www.it-ebooks.infoCONTENTS
viii
2
Distributing and loading your application
21
2.1
Configuring your environment for third-party
development 22
Publisher test page
23
The web server
23
Simulating
multiple domains
24
2.2
Loading the initial script 26
Blocking script includes
26
Nonblocking scripts with async and
defer
27
Dynamic script insertion
29
2.3
The initial script file
31
Aliasing window and undefined 31
Basic application flow 32
2.4
Loading additional files
33
JavaScript files
34
Libraries
36
2.5
Passing script arguments
38
Using the query string
38
Using the fragment identifier
41
Using custom data attributes
42
Using global variables
43
2.6
Fetching application data 45
2.7
Summary
47
3
Rendering HTML and CSS
48
3.1
Outputting HTML
49
Using document.write
49
Appending to a known location 50
Appending multiple widgets
52
Decoupling render targets
54
3.2
Styling your HTML
55
Using inline styles
55
Loading CSS files
56
Embedding
CSS in JavaScript 58
3.3
Defensive HTML and CSS 61
Namespaces
61
CSS specificity
62
Overspecifying CSS
64
3.4
Embedding content in iframes 66
Src-less iframes
68
External iframes
70
Inheriting
styles
71
When to refrain from using iframes? 75
3.5
Summary
76
4
Communicating wi
th the server
77
4.1 AJAX and the browser same-origin policy
78
Rules for determining same origin
80
Same-origin policy and
script loading
80
www.it-ebooks.infoCONTENTS
ix
4.2 JSON with padding (JSONP) 82
Loading JSON via script elements
82
Dynamic callback
functions
84
Limitations and security concerns
86
4.3
Subdomain proxies 88
Changing a document’s origin using document.domain
89
Cross-origin messaging using subdomain proxies
91
Combining subdomain proxies with JSONP
94
Internet
Explorer and subdomain proxies
97
Security implications
98
4.4
Cross-origin resource sharing 99
Sending simple HTTP requests
99
Transferring cookies
with CORS
102
Sending preflight requests
102
Browser support
103
4.5
Summary
104
5
Cross-domain iframe messaging
105
5.1
HTML5 window.postMessage API
106
Sending messages using window.postMessage
107
Receiving messages sent to a window
109
Browser
support
110
5.2
Fallback techniques
112
Sending messages using window.name
112
Sending
messages using the URL fragment identifier
115
Sending
messages using Flash
118
5.3
Simple cross-domain messaging with easyXDM
120
Loading and initializing easyXDM
121
Sending simple
messages using easyXDM.Socket
123
Defining JSON-RPC
interfaces using easyXDM.Rpc
125
5.4
Summary
129
6
Authentication and sessions
131
6.1
Third-party cookies
132
Setting and reading sessions
133
Disabling third-party
cookies
134
Internet Explorer and P3P headers
136
Detecting when cookies are unavailable
138
6.2
Setting third-party cookies
140
Using dedicated windows
141
Iframe workaround
(Safari only)
144
Single-page sessions for Chrome
and Firefox
146
www.it-ebooks.infoCONTENTS
x
6.3
Securing sessions
147
HTTPS and secure cookies
148
Multilevel authentication
149
6.4
Summary
151
7
Security
152
7.1
Cookies, sessions, and session theft
153
7.2
Cross-site scripting
154
XSS attacks
155
XSS vulnerabilities in CSS
157
Defending your application against XSS attacks
159
7.3
Cross-site request forgery
161
XSRF attacks
161
JSON hijacking
163
Defending
your application against XSRF attacks
164
7.4
Publisher vulnerabilities
166
Publisher impersonation
166
Clickjacking
168
Denial of service
170
7.5
Summary
171
8
Developing a third-party JavaScript SDK
172
8.1
Implementing a bare-bones SDK
175
Initialization
175
Asynchronous loading
176
Exposing public functions
179
Event listeners
180
8.2
Versioning
182
URL versioning
183
Versioned initialization
185
8.3
Wrapping web service APIs
188
Accessing web service APIs on the client
188
Wrapping the
Camera Stork API
191
Identifying publishers
195
User authorization and OAuth
200
8.4
Summary
201
9
Performance
202
9.1
Optimizing payload
203
Combining and minifying source code
204
Reducing image
requests
205
Caching files
207
Deferring HTTP
requests
208
www.it-ebooks.infoCONTENTS
xi
9.2
Optimizing JavaScript 213
Inside the browser: UI thread, repaint, and
reflow
214
Controlling expensive calls: throttle and
debounce
215
Deferring computation with setTimeout
218
9.3
Perceived performance 220
Optimistic user actions
220
Rendering before document
ready
222
9.4
Summary
223
10
Debugging and testing
224
10.1
Debugging
225
Serving development code in production
227
Stepping through
the code
233
10.2
Testing
237
Unit, integration, and regression tests
238
Writing regression
tests using QUnit
240
Writing regression tests using Hiro 243
10.3
Summary
246
index
249

实例下载地址

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
;
报警