Ajax¿çÓòÎÊÌâ½â¾ö·½°¸
ÓÉÓÚ°²È«ÎÊÌâµÄ¿¼ÂÇ£¬Ajax(xmlhttprequest)ĬÈÏÊDz»Ö§³Ö¿çÓòµ÷Óõġ£±ÈÈçÔÚwww.cadal.comÈ¥ÇëÇówww.test.cadal.comµÄÊý¾Ý£¬¶¼ÊDz»Ðеġ£
½â¾ö·½°¸Óкܶ࣬×ܽáÈçÏ£º
²Î¿¼£º
1.ÀûÓÃ<script>±êÇ©
Difficult to know when the content is available, no standard methodology, can be considered a "security risk".
scriptÉèÖÃUrlºó×Ô¶¯»áÖ´ÐÐ
example
簾裼
var data=123;
¿Í»§¶Ë£º
<html>
<body>
<mce:script id="test"></mce:script>
<input type="button" id="button" value="»ñÈ¡" onclick="get('http://test.cadal.com/demo/test.asp');">
<mce:script type="text/javascript"><!--
function get(url)
{
document.getElementById("test").src=url;
alert(data);
}
// --></mce:script>
</body>
</html>
2.´úÀí
Local proxy:
Needs infrastructure (can't run a serverless client) and you get double-taxed on bandwidth and latency (remote - proxy - client).
ÀûÓÃÈ綯̬ÍøÒ³ASP JSP PHPµÈ½øÐдúÀí£¬½øÐÐÖÐת£¬È±µãÏÔ¶øÒ×¼û¡£
3.frame·½·¨
ÔÚͬһ¸öÓòϵĸ÷¸ö×ÓÓòÖ®¼ä£¨·ÇÍêÈ«¿çÓò£©£¬Èç¹ûÉèÖÃÁËdocument.domain£¬ÄÇôÊÇ¿ÉÒÔÏ໥֮¼äµ÷ÓÃjsµÄ¡£¡£ÀûÓÃÕâÒ»µã£¬¿ÉÒÔÔÚtest.zzsky.cnÏÂÃæ·ÅÉÏÒ»¸öÒ³Ã棬Õâ¸öÒ³Ãæ¿ÉÒÔÍê³ÉÓÃajax»ñȡͬһ¸ö×ÓÓòwww.test.cadal.comµÄÊý¾Ý£¬¶øÔÚ www.cadal.comÏ¿ò¼ÜÕâ¸öÒ³£¬ÕâÑù¾Í¿ÉÒÔ²Ù×ݱ»¿ò¼ÜÒ³À´»ñÈ¡Êý¾ÝÁË¡£
example
Ô¶¶Ëframe£º
<html>
<head>
<mce:script type="text/javascript" src="http://www.cadal.com/demo/ajax-cross-domain/Ajax.js" mce_src="http://www.cadal.com/demo/ajax-cross-domain/Ajax.js"></mce:script>
<mce:script type="text/javascript"><!--
document.domain="cadal.com";
// --></mce:script>
</head>
<body>
</body>
</html>
¿Í»§¶Ë£º
<html>
<head>
<mce:script type="text/javascript"><!--
document.domain="cadal.com";
// --></mce:script>
<body>
<iframe src="http://test.cadal.com/demo/iframe.htm" mce_src="http://te
Ïà¹ØÎĵµ£º
ʹÓÃÔʼµÄXMLHttpRequest·¢³öÇëÇóʱ,Ö»ÄܶÔServletºÍJSP²Ù×÷
ÔÚJSPÖд´½¨3¸öfunction
1.createXmlHttpRequest----¸ºÔðÅжÏä¯ÀÀÆ÷ÀàÐÍ´´½¨ XMLHttpRequest¶ÔÏó
var xmlHttpRequest;
function createXMLHttpRequest(){
// IE ä¯ÀÀÆ÷
if(window.ActiveXObject){
&nbs ......
Case I. Web´úÀíµÄ·½Ê½ (on Server A)
¼´Óû§·ÃÎÊAÍøվʱËù²úÉúµÄ¶ÔBÍøÕ¾µÄ¿çÓò·ÃÎÊÇëÇó¾ùÌá½»µ½AÍøÕ¾µÄÖ¸¶¨Ò³Ã棬ÓɸÃÒ³Ãæ´úÌæÓû§Ò³ÃæÍê³É½»»¥£¬´Ó¶ø·µ»ØºÏÊʵĽá¹û¡£´Ë·½°¸¿ÉÒÔ½â¾öÏֽ׶ÎËùÄܹ»Ïëµ½µÄ¶àÊý¿çÓò·ÃÎÊÎÊÌ⣬µ«ÒªÇóAÍøÕ¾ÌṩWeb´úÀíµÄÖ§³Ö£¬Òò´ËAÍøÕ¾ÓëBÍøÕ¾Ö®¼ä±ØÐëÊǽôÃÜÐ×÷µÄ£¬ÇÒÿ´Î½»»¥¹ý³Ì£¬AÍøÕ¾µÄ· ......
ScriptManager.RegisterStartupScript(p1, this.GetType(), "click", "alert('ok')", true);//p1ÊÇupdatepanelµÄid
ScriptManager.RegisterStartupScript(p1, this.GetType(), "click", "alert('ok')", true);//p1ÊÇupdatepanelµÄid
......