How To Use XmlHttpRequest Across Sub-Domains Cómo utilizar XMLHttpRequest a través de sub-dominios
As you probably know XmlHttpRequest only works if the request is made to the same web server from which the page was fetched ( Como seguramente sabrá, XMLHttpRequest sólo funciona si se hace la petición para el mismo servidor web de que la página se descargue ( same origin mismo origen ). Here is a way to communicate across sub-domains using XmlHttpRequest without resorting to reverse proxying. Aquí está una manera de comunicarse a través de sub-dominios usando XMLHttpRequest sin recurrir a proxy inverso.
Abe (@ fettig.net) found a solution using iframe and an exception to the “same origin” rule. Abe (@ fettig.net) encontró una solución con iframe y una excepción al "mismo origen" regla. A script can set the value of document.domain to a suffix of the current domain. Un script puede fijar el valor de document.domain a un sufijo de dominio de la actual. If it does so, the shorter domain is used for subsequent origin checks. Si lo hace, cuanto más corta es de dominio se utiliza para los controles posteriores origen. Thus scripts running in either frame will now be allowed to talk to each other. Así scripts en funcionamiento, ya sea en el marco ahora se permitía a hablar unos con otros.
This method has a limitation as you can only make XmlHttpRequest calls up to the point where you set document.domain. Este método tiene una limitación en cuanto sólo puede hacer llamadas XMLHttpRequest hasta el punto donde se define document.domain. Once you do that, you gain the ability to communicate with the parent frame, but you lose the ability to make future XmlHttpRequest calls. Una vez que usted hace, usted gana la habilidad de comunicarse con los padres marco, pero se pierde la capacidad de hacer llamadas XMLHttpRequest futuro.
Abe tried switching document.domain to make subsequent calls but that failed in Opera and Mozilla browsers. Abe intentó cambiar document.domain a hacer las próximas convocatorias, pero que fracasó en Opera y Mozilla browsers. So he first tries switching document.domain in his code which works for Internet Explorer. Así que primero intenta cambiar document.domain en su código que funciona para Internet Explorer. If that fails then he uses a bridge frame to overcome the restrictions - document.location.replace(”test4-bridge.html”); Si eso falla, entonces se utiliza un marco de puente para superar las restricciones - document.location.replace ( "test4-bridge.html");
This bridge frame hack has been tested only on Mozilla browsers. Este puente marco hack ha sido probado sólo en los navegadores Mozilla. So in essence his solution works for Internet Explorer and Mozilla groups of browsers. Así que, en esencia, su solución funciona para Internet Explorer y Mozilla grupos de exploradores.
Read about his adventure Lee sobre su aventura here aquí .
I think such solutions, though ingenuous, are inherently fragile as they exploit a security loophole in browser implementation which is likely to be plugged in future. Creo que este tipo de soluciones, aunque ingenua, son inherentemente frágiles, ya que la explotación de una laguna en la seguridad del navegador aplicación que pueda ser conectado en el futuro.
Filed under Filed under Computer Security Seguridad informática , Firefox , Headline News Headline News , How To Cómo , Internet Explorer Internet Explorer , Tech Note Nota técnica , Web , Web Services Web Services | |
| |
RSS 2.0 RSS 2,0 | |
Trackback this Article | este artículo |
Email this Article Enviar artículo
You may also like to read También puede leer |



