cross-domain

Unsafe JavaScript attempt to access frame with URL

别来无恙 提交于 2019-12-17 02:42:17
问题 I am getting the below error when i try to set a hash value to the parent url from iframe which contains another domain url: Unsafe JavaScript attempt to access frame with URL "URL1" from frame with URL "URL2". Domains, protocols and ports must match. How can I fix this problem? 回答1: From a child document of different origin you are not allowed access to the top window's location.hash property, but you are allowed to set the location property itself. This means that given that the top windows

htaccess Access-Control-Allow-Origin

江枫思渺然 提交于 2019-12-17 02:41:14
问题 I'm creating a script that loads externally on other sites. It loads CSS and HTML and works fine on my own servers. However, when I try it on another website it displays this awful error: Access-Control-Allow-Origin Here you can see it loads perfectly: http://tzook.info/bot/ But on this other website it shows the error: http://cantloseweight.co/robot/ I uploaded the loading script to jsfiddle: http://jsfiddle.net/TL5LK/ I tried editing the htaccess file like this: <IfModule mod_headers.c>

How do I send an AJAX request on a different port with jQuery?

删除回忆录丶 提交于 2019-12-17 02:36:09
问题 I need to send an AJAX request to, for example, port 8080 where a daemon is running there. 回答1: You cannot POST information cross domain, subdomain, or port number. You can however use JSONP if you have access to both the daemon and the requesting site. If data needs to be returned, then the daemon needs to support a callback query parameter and return it properly formatted. Pass the information to the daemon: $.getJSON('http://domain.com:8080/url/here?callback=?', { key: 'value', otherKey:

How do I get a computed style?

萝らか妹 提交于 2019-12-17 02:33:10
问题 Can anybody please help me with a script.. or a way to get the value of height : 1196px; width: 284px; from the computed style sheet (webkit). I know IE is different- as usual. I cannot access the iframe (cross domain)—I just need the height/width. Screenshot of what I need (circled in red). How do I access those properties? Source <iframe id="frameId" src="anotherdomain\brsstart.htm"> <html id="brshtml" xmlns="http://www.w3.org/1999/xhtml"> \--I WANT THIS ELEMENTS COMPUTED BROWSER CSS HEIGHT

Setting cross-domain cookies in Safari

牧云@^-^@ 提交于 2019-12-17 02:08:14
问题 I have to call domain A.com (which sets the cookies with http) from domain B.com. All I do on domain B.com is (javascript): var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.src = "A.com/setCookie?cache=1231213123"; head.appendChild(script); This sets the cookie on A.com on every browser I've tested, except Safari. Amazingly this works in IE6, even without the P3P headers. Is there any way to make this work in Safari? 回答1: From the

XMLHttpRequest cannot load an URL with jQuery

爷,独闯天下 提交于 2019-12-16 22:43:28
问题 I'm trying to get some json data from a "remote" website. I run my web service on the 99000 port then, I launch my website on the 99001 port (http://localhost:99001/index.html). I get the following message: XMLHttpRequest cannot load http://localhost:99000/Services.svc/ReturnPersons. Origin http://localhost:99001 is not allowed by Access-Control-Allow-Origin. Even If I launch my web page as an HTML file, I get this: XMLHttpRequest cannot load http://localhost:99000/Services.svc/ReturnPersons

AJAX in Chrome sending OPTIONS instead of GET/POST/PUT/DELETE?

此生再无相见时 提交于 2019-12-16 22:08:33
问题 I am working on an internal web application at work. In IE10 the requests work fine, but in Chrome all the AJAX requests (which there are many) are sent using OPTIONS instead of whatever defined method I give it. Technically my requests are "cross domain." The site is served on localhost:6120 and the service I'm making AJAX requests to is on 57124. This closed jquery bug defines the issue, but not a real fix. What can I do to use the proper http method in ajax requests? Edit: This is in the

Send analytic data to different domain without response

旧时模样 提交于 2019-12-14 04:23:14
问题 Precondition I own mysite.com I do not own othersite.com , but I can embed javascript code there Question How to send analytic data from othersite.com to mysite.com ? Expected : othersite.com client -> mysite.com server Not expected : othersite.com client -> othersite.com server -> mysite.com server Its principle seems like to be similar with Google Analytics , but I don't know the exact principle I know that it couldn't be done by ajax due to cross-domain problem How does it change if I own

Can I violate the same-origin policy with a Java applet

青春壹個敷衍的年華 提交于 2019-12-14 04:18:38
问题 I need to request things and get information from other domains. I know javascript can not do this due to the same origin policy. My other option is to make proxy requests through my server. I do not want the requests coming from my server's IP nor do I want to create additional load for my server and would prefer the client do it. Is it possible to use a Java applet to do this? Manually configuring security settings is not an issue. 回答1: Java applets do implement the same origin policy, much

xmlhttprequest not firing response event handler for ready state 3 when using flush from php

牧云@^-^@ 提交于 2019-12-14 03:58:55
问题 I am sending a request a remote server from google chrom extension using xmlhttprequest I have set permissions in the manifest.json to access remote hosts Basically it is working fine as expected. what i had expected is readystate 4 it is fired when the response has completed. Since it is a 8 to 10 second process in the server side i use echo from the server side to the client for status update. so i use readyState==3 condition to show server response but when i tested readystate 1 and 4 are