## Cross-Domain Communication - Focus: Cross-domain Network Communication - Problem: - XMLHttpRequest initially used the SOP - SOP often too restrictive for this use case - e.g., authentication backend at a different origin, data on different servers - How to perform cross-domain requests? - Adobe Flash - JSONP - Cross-Origin Resource Sharing (see *Policies*) #### Adobe Flash - Allows cross-domain communication - Includes all cookies for requests - Flash does not inherit origin - e.g., Flash from `a.com` can create requests to `a.com` (with cookies) if included on `b.com` - Remote server must allow communication - Only for remotes with other origins (not the Flash-providing origin) - List of allowed hosts - Config file: `crossdomain.xml` - First, config file is fetched from remote server - 2016: Used by 8 % of sites ![](images/03-flash.png) #### JSONP - *JSON with Padding* - Use Case: - Script wants to load resource from remote host (e.g., JSON data) - Problem: - SOP prohibits *reading* resources from other origins - Idea: *Embed* external resource (allowed by SOP) - Loading JSON in `