#Random Random questions related to web dev.
- Cookies, localStorage, IndexDB
- DOM
- Ajax
Same-origin must have the same:
- domain name (google.com vs apple.com)
- protocol (http vs https)
- port number (4080 vs 80)
PS: A page may change its own origin with some limitations. A script can set the value of document.domain to its current domain or a superdomain of its current domain. If it sets it to a superdomain of its current domain, the shorter domain is used for subsequent origin checks.
For example, assume a script in the document at http://store.company.com/dir/other.html executes the following statement: Like:
document.domain = "company.com";
More info: Ref: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
- JSONP (Only support
GET
, more info: http://stackoverflow.com/questions/3839966/can-anyone-explain-what-jsonp-is-in-layman-terms, and (Chinese): http://www.cnblogs.com/dowinning/archive/2012/04/19/json-jsonp-jquery.html) - Server delegation (server does the request to different origin)
- WebSocket (WebSocket have no same-origin policy)
- CORS (Cross-Origin Resource Sharing)
http://stackoverflow.com/questions/2092527/what-happens-when-you-type-in-a-url-in-browser
http://stackoverflow.com/questions/3477333/what-is-the-difference-between-post-and-get
http://stackoverflow.com/questions/630453/put-vs-post-in-rest