My gadget is receiving 404 responses from calls to
gadgets.io.makeRequest with commonly used urls (e.g. http://www.nytimes.com,
http://www.engadget.com). Other urls work fine, however sub pages
within these problem domains also do not work. Is this due to these
domains blocking requests from google.com? Or is there something wrong
with my code (shown below)? Any help is appreciated!
<Content type="html" view="canvas">
<![CDATA[
<div id='content_div'></div>
<script type="text/javascript">
var url;
function onLoadHand () {
var params = {};
params
[gadgets.io.RequestParameters.CONTENT_TYPE] =
gadgets.io.ContentType.TEXT;
var prefs = new gadgets.Prefs();
url = prefs.getString("fasturl");
var pattern = new RegExp("http\:\/\/"); /*
Remove http:// from the url */
url = url.replace(pattern, "");
url = "http://" + url;
gadgets.window.adjustHeight(window.outerHeight*.
50);
gadgets.io.makeRequest(url, response, params);
}
function response(obj) {
//obj.text contains the text of the page that was
requested
var html = obj.text;
if (html == null || html == "") {
html = "<h1 style='{text-align:
center}'>Page Cannot Be Displayed</h1><div style='{text-align:
center}'>"
+ obj.errors + "</
div>";
document.getElementById
('content_div').innerHTML = html;
return;
}
/* v2.0 resolves relative urls */
var pattern = new RegExp("href=\"\/",
"gm");
html = html.replace(pattern, "href=\"" + url +
"\/");
document.getElementById('content_div').innerHTML =
html;
}
gadgets.util.registerOnLoadHandler(onLoadHand);
</script>
]]>
</Content>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Gadgets-API?hl=en
-~----------~----~----~----~------~----~------~--~---