Search code examples
javascriptjqueryhtmlhtml5-appcache

Why caching HTML5 page prevent doing Cors request?


Why caching an application prevent Cors request?

I have an example, two html page exactly Identical except the second line :

index.html link

<!DOCTYPE html>
<html manifest="main.appcache">

index2.html link

<!DOCTYPE html>
<html>

Why the one without manifest is working fine and the one with manifest works only the first time and stop working when the application is cached? (press F5 several times)

I tested with Firefox, Chrome and IE.


Solution

  • According to this article

    NETWORK: Files listed in this section may come from the network if they aren't in the cache, otherwise the network isn't used, even if the user is online. You can white-list specific URLs here, or simply "*", which allows all URLs. Most sites need "*".

    So behaviour you've described is appropriate, because your appcache manifest doesn't contain NETWORK section.

    Update: request that fails - isn't CORS - because domain, protocol and port are the same.