I was asked a question below and cannot find the answer. I looked up similar posts, but many posts (like this) ended up talking about cross-origin, not cross-domain. What is the answer to the below question?
Q: Assume you are working on a webpage at http://example.com/path/to/foo.html. if you were to send an AJAX request to the following URLs, which one would NOT trigger a cross-domain violation?
- http://example.com/bar
- https://example.com/path/to/bar.html
- https://example.com:80/bar
- http://www.example.com/bar
- C and D
Thank you in advance.
CodePudding user response:
Due to this:
A resource is cross-origin when it's located at a different (sub)domain, protocol, or port!
You should not get CORS in option 1 and 4
Take a look at this article fully describe CORS.
