2

我正在尝试使用 gadgets.io.makeRequest 来检索站点http://www.novasoftware.se/webviewer/(S(r2vc0j45wbu53x55slbdce55))/MZDesign1.aspx?schoolid=27500&code=82820 它以前工作过,但现在它返回空的html:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> -->
<HTML>
<HEAD>
 <META HTTP-EQUIV="Refresh" CONTENT="0.1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<TITLE></TITLE>
</HEAD>
<BODY>
<P>
</BODY>
</HTML>

这是我正在使用的简单代码:

<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="My test gadget" height="400"/>
<Content type="html"><![CDATA[
<script type="text/javascript">

function getHtml() {    
  var params = {};  
 params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT;  
 var url = "http://www.novasoftware.se/webviewer/(S(r2vc0j45wbu53x55slbdce55))/MZDesign1.aspx?schoolid=27500&code=82820";
  gadgets.io.makeRequest(url, response, params);
};
function response(obj) {  
 //obj.text contains the text of the page that was requested  
  var html = obj.text;
  console.log(html);
  document.getElementById('content_div').innerHTML = html;
};
gadgets.util.registerOnLoadHandler(getHtml);
</script>
<div id="content_div"><p>Content here</p></div>
]]>  
</Content>
</Module>

有没有可能是网站屏蔽了?我怎么看?相同的代码适用于http://www.google.com等其他 URL 我在返回字符串中也没有任何错误

4

0 回答 0