Startseite Mathematik Chapter 7: Browser-Server Communication
Kapitel
Lizenziert
Nicht lizenziert Erfordert eine Authentifizierung

Chapter 7: Browser-Server Communication

Weitere Titel anzeigen von Mercury Learning and Information
HTML 5 Pocket Primer
Ein Kapitel aus dem Buch HTML 5 Pocket Primer
CHAPTERThis chapter provides an overview of various communication technol-ogies in HTML5, such as AJAX, XHR2, SSE, Web Messaging, and WebSockets. The first part of this chapter discusses CORS (Cross-Origin Resource Sharing), after which the code sample that uses AJAX with XHR2 (XmlHTTPRequest2) will make sense. In addition, the XHR2 sec-tion contains three AJAX-related examples, starting with a generic AJAX code sample, followed by a jQuery-based AJAX code sample. The next part of this chapter discusses Web Messaging and SSE, and the final part provides an overview of Web Intents and Web Notifications. HTML5 CROSS-ORIGIN RESOURCE SHARING (CORS)In brief, the “same origin policy” allows scripts that originate from the same site to execute, and they can access each other’s methods and properties with with-out restriction. On the other hand, cross-origin resource sharing (CORS) specifies the ways in which a web server can allow its resources to be accessed by web pages from different domains. Although CORS is more flexible than “same origin policy”, it does not allow access to resources by any and all requests. In simplified terms, the CORS specification provides support for cross-domain communication by means of a simple header exchange between a client and a server. Some of the new HTTP headers for the CORS specification are OPTIONS, ORIGIN, and Access-Control-Allow-Origin. When the appropriate CORS headers are provided, CORS makes it possible to make asynchronous HTTP requests to other domains.The CORS API uses the XMLHttpRequest object as a “container” for sending and receiving the requisite headers for CORS, and also the with-Credentials property that can be used for determining programmatically whether or not an XMLHttpRequest object supports CORS.7BROWSER-SERVER COMMUNICATION
© 2013 Walter de Gruyter GmbH, Berlin/Boston

CHAPTERThis chapter provides an overview of various communication technol-ogies in HTML5, such as AJAX, XHR2, SSE, Web Messaging, and WebSockets. The first part of this chapter discusses CORS (Cross-Origin Resource Sharing), after which the code sample that uses AJAX with XHR2 (XmlHTTPRequest2) will make sense. In addition, the XHR2 sec-tion contains three AJAX-related examples, starting with a generic AJAX code sample, followed by a jQuery-based AJAX code sample. The next part of this chapter discusses Web Messaging and SSE, and the final part provides an overview of Web Intents and Web Notifications. HTML5 CROSS-ORIGIN RESOURCE SHARING (CORS)In brief, the “same origin policy” allows scripts that originate from the same site to execute, and they can access each other’s methods and properties with with-out restriction. On the other hand, cross-origin resource sharing (CORS) specifies the ways in which a web server can allow its resources to be accessed by web pages from different domains. Although CORS is more flexible than “same origin policy”, it does not allow access to resources by any and all requests. In simplified terms, the CORS specification provides support for cross-domain communication by means of a simple header exchange between a client and a server. Some of the new HTTP headers for the CORS specification are OPTIONS, ORIGIN, and Access-Control-Allow-Origin. When the appropriate CORS headers are provided, CORS makes it possible to make asynchronous HTTP requests to other domains.The CORS API uses the XMLHttpRequest object as a “container” for sending and receiving the requisite headers for CORS, and also the with-Credentials property that can be used for determining programmatically whether or not an XMLHttpRequest object supports CORS.7BROWSER-SERVER COMMUNICATION
© 2013 Walter de Gruyter GmbH, Berlin/Boston
Heruntergeladen am 23.9.2025 von https://www.degruyterbrill.com/document/doi/10.1515/9781938549120-010/html?lang=de&srsltid=AfmBOopYYWMpjqENkJJ0KwBVKtCg-lBJBe-m1OznoVO3NnJkFReK6du1
Button zum nach oben scrollen