same-origin-policy

How does the same origin policy apply to IP addresses

不羁的心 提交于 2019-11-30 05:32:48
问题 I have a server on our company intranet that runs JBoss. I want to send API calls to this server from my machine, also on the intranet, and get the resulting XML responses using JQuery. I read the entry on Wikipedia but am confused how that applies to my situation, since our machines only have IP addresses, not domain names. I have server URL : 10.2.200.3:8001/serviceroot/service client IP address : 10.2.201.217 My questions are: As far as I understand these are different domains, right? So I

Can iframe pages tell when they are iframed?

对着背影说爱祢 提交于 2019-11-30 04:07:40
问题 So I know that if I include an iFrame to a page that is not on the same domain I can't access that iframe's DOM via browser policy, but can a page that is in an iframe do any kind of parent document accessing? Specifically I have to ideas that are contingent on this question: If the embedded page can tell that it is not the parent window, one could make either sites that are un-iframe-able so that if the page detects it is iframed it changes to a "Go Away" page OR you could make it only

Cross domain xmlhttp

大城市里の小女人 提交于 2019-11-29 23:50:40
问题 I am writing this javascript that will be used on several other domains which calls a php script(only on my domain) to return an array. I am using xmlhttp and it works great when testing on my domain, but as soon as the javascript is placed or called from a separate domain it completely breaks. Anybody know how to make this request cross-domain? Note: I had to perform a weird little hack to allow me to make two separate calls and make sure that they were both returned before processing.

How can I sandbox untrusted user-submitted JavaScript content?

断了今生、忘了曾经 提交于 2019-11-29 19:33:55
I need to serve user-submitted scripts on my site (sort of like jsfiddle ). I want the scripts to run on visitors browsers in a safe manner, isolated from the page they are served on. Since the code is submitted by users, there is no guarantee it is trustworthy. Right now I can think of three options: Serve the user-submitted content in an iframe from a different domain , and rely on the same-origin policy. This would require setting up an additional domain which I'd like to avoid if possible. I believe this is how jsfiddle does it. The script can still do some damage, changing top.location

What is the concept behind Access-Control-Allow-Origin and CORS?

倖福魔咒の 提交于 2019-11-29 15:44:35
I don't really get Access-Control-Allow-Origin and CORS. If I allow request from any domain to my page, does that imply any security issues for my page? I always thought, that SOP ensures, that there can't run any script on a page, which requests data from another server, as that data might be malicious. But as the server, which serves the malicious data, can just reply with a header containing Access-Control-Allow-Origin:* , everything can be loaded from that server. So as soon as somebody manages to inject a piece of JS code into a page, every malicious code can be loaded from a server

Are 127.0.0.1 and localhost considered as two different domains by browsers?

随声附和 提交于 2019-11-29 14:50:56
Are 127.0.0.1 and localhost considered as two different domains by browsers and therefore enforce cross-domain (same origin policy) restrictions? I observed it works sometime (in case of simple web pages) and does not work with Flex based web pages. For example: Scenario I: In a web page called page1.htm, you call a script as follows: <script type="text/javascript" src="js/somejsscript.js"></script> or <script type="text/javascript" src="http://localhost/js/somejsscript.js"></script> and you access the page as http://localhost/page1.htm Scenario II: You call the script as follows: <script type

Will jQuery .load() Work On PhoneGap?

随声附和 提交于 2019-11-29 12:20:24
I know that the jQuery .load() function has a "problem": You can't retrieve pages that are outside of the current domain, because of the Same Origin Policy , but I remember when I was developing another program that I could do cross-domain AJAX without problems while on an PhoneGap compiled environment, but will it work while on PhoneGap(like normal AJAX) or it will just fail because of the policy? Jasper You can use .load() or $.ajax() in PhoneGap applications. Most of my experience is with getting information from the same domain under which the app. is packaged. For example: App. package

CORS Access-Control-Max-Age is ignored

早过忘川 提交于 2019-11-29 11:24:28
问题 I'm hosting an WebApp and his API on different domains and use CORS to be able to work around the same origin policy. So far, so good. This works. To only send a CORS preflight once per session I set the Access-Control-Max-Age to 20 days, But this is not working (tested in Chrome): https://db.tt/vfIW3fD2 What do I have to change? 回答1: If you are using Chrome Dev Tools, make sure you have "Disable cache (while DevTools is open)" unchecked . I was having issues with the "Access-Control-Max-Age"

Same origin policy - Subdomains and Root Domain

吃可爱长大的小学妹 提交于 2019-11-29 09:19:02
I have a question regarding the same-origin policy. My company has many subdomains and in one of them they would like an iframe with another subdomain inside of it and populate the form of the iframe. I have read about the document.domain property and that I would need to set in on all three domains, however I can not easily test this due to each subdomain belonging to a different department. So here is my question: Is this possible when the subdomains are both https, and the root domain is not? I looked at the examples on wikipedia, but that didn't help me. Any help would be greatly

Postman extension get a response, but my jquery request not [duplicate]

萝らか妹 提交于 2019-11-29 08:53:59
问题 This question already has an answer here: Why does my JavaScript code get a “No 'Access-Control-Allow-Origin' header is present on the requested resource” error when Postman does not? 44 answers I make a GET request using Postman extension and obtain a response, but if I make the same request using jQuery I receive a typical error: XMLHttpRequest cannot load http://www.rfen.es/publicacion/ranking/resultsBySwimmer.asp?l=020039535&t=&p=0&e=50L-I. No 'Access-Control-Allow-Origin' header is