Hi Jesse,
I don't see anything wrong with your code. If you are getting the HTML
content properly for some sites with this same code, then this is
pretty much a confirmation that your fetcher is working as expected.
If you are still having an issue, it would be great if you could:
- post the URL to your test gadget here - this would make it easier
for others to test this out and possibly see what could be going
wrong, rather than having to copy and paste
- specify where your gadget is running: iGoogle production, iGoogle
sandbox, other gadget platform?
I have been successful with using the Engadget RSS feed using the
legacy API _IG_FetchFeedAsJSON('http://www.engadget.com/rss.xml',...)
so you could be using this option rather than hitting the Engadget
mainpage and then parsing the content. But, I don't see why fetching
the Engadget (or New York Times) would fail with a 404. They have no
reason to turn away the Google fetchers, as this could lead to their
content indexing being impacted.
Thanks,
Jerome
On Dec 4, 7:06 pm, Jesse Varnado <[EMAIL PROTECTED]> wrote:
> 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
-~----------~----~----~----~------~----~------~--~---