我想写一个方法调用新浪的天气预报。
在IE上,成功执行,但是在firefox上,总是报错:
“调用方法XmlHttpRequest.open时权限不足”怎么办???关键句代码如下:
xmlhttp.open("GET","http://php.weather.sina.com.cn/search.php?city="+city,true);
在IE上,成功执行,但是在firefox上,总是报错:
“调用方法XmlHttpRequest.open时权限不足”怎么办???关键句代码如下:
xmlhttp.open("GET","http://php.weather.sina.com.cn/search.php?city="+city,true);
这是因为firefox安全性强,不允许跨域调用。Firefox 要取消XMLHttpRequest的跨域限制的话,
第一是从 about:config 里设置 signed.applets.codebase_principal_support = true; (地址栏输入about:config 即可进行firefox设置)
第二就是在open的代码函数前加入类似如下的代码:
try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); } catch (e) { alert("Permission UniversalBrowserRead denied."); }
<iframe src="http://weather.265.com/weather.htm" width="160" height="54" frameborder="no"
border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
不用Ajax越来越不喜欢Ajax了
QQ群:11317177
问题已经按照一楼的方法解决了。
我不是做网站,客户也就几个人。他们也接受配置的改动。呵呵后台代码里通过xmlhttprequest获取天气代码。后台版本已经的差不多定型了,实在不想改动了
www.mesou.net首页左侧天气预报板块源代码下载
http://www.mesou.net/ShowDe.aspx?GetPara=52&NextPara=12682
我回复的时候看到的加载xml文件错误,请跟斑竹联系!!请斑竹生成以下社区的贴子列表!!
roomid:5202
typenum:2
请用后台做中转媒介