Example of Event Handlers in HTML5 CORS

JavascriptWeb DevelopmentFront End Scripts

Cross-origin resource sharing (CORS) is a mechanism to allows the restricted resources from another domain in a web browser

For suppose, if you click on HTML5- video player in html5 demo sections. It will ask camera permission. If the user allows the permission then only it will open the camera or else it doesn't open the camera for web applications.

The following is an example of event handlers in CORS:

xhr.onload = function() {
   var responseText = xhr.responseText;
   // process the response.
xhr.onerror = function() {
   console.log('There was an error!');
Published on 10-Apr-2018 14:27:51