Reimplemented cross-domain checks

Instead of just avoiding file:// it actually checks the domain the url
has against the window domain.
Merge pull request #1437 from aadsm/fix-preloading-resources

Reimplemented cross-domain checks