Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8852199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:20:25+00:00 2026-06-14T13:20:25+00:00

I am building a javascript component for Firefox that will take in a zip

  • 0

I am building a javascript component for Firefox that will take in a zip code, and will return the current weather conditions.

The sample code that weather underground uses jQuery, but as I understand it, I cannot include this code in my javascript component, as javascript does not have the functionality to include other javascript files.

At any rate, I have built up my skeleton code. It takes in the zip code and builds up the url

(example: http://api.wunderground.com/api/e17115d7e24a448e/geolookup/conditions/q/22203.json)

I have tried downloading the data from that url, via the following method:

getWeatherByUrl: function(url)
{
    var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(Components.interfaces.nsIWebBrowserPersist);
    var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD",Components.interfaces.nsILocalFile);
    file.append("weather-forecaster.dat");
    var urlURI = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newURI(url, null, null);        
    persist.saveURI(urlURI,null,null,null,"",file);
    return url;
}

This should download the file to the user’s profile directory. It indeed does create the file there. However, it does not look like it contains the json data from weather underground.

What exactly is going on? How would I download the file? I believe that there is a query going on when that url is passed to weather underground, but that shouldn’t matter as the .json page is what gets spit out from them, right?

Is there a way to do this without downloading the file, but by streaming it and parsing it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:20:26+00:00Added an answer on June 14, 2026 at 1:20 pm

    You can simply use XMLHttpRequest to download this data:

    var request = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
                            .createInstance(Components.interfaces.nsIXMLHttpRequest);
    request.open("GET", "http://api.wunderground.com/api/Your_Key/geolookup/conditions/q/IA/Cedar_Rapids.json");
    request.addEventListener("load", function(event)
    {
      var data = JSON.parse(request.responseText);
      alert(data.response.version);
    }, false);
    request.send(null);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a firefox addon that loads javascript at every page load. I'm
I'm building a concert calendar that's very heavy on javascript (using jQuery). I'm having
When building code like this: <script type=text/javascript src=<%=ResolveUrl(~/js/js.js)%>></script> or <input type=image src=<%=ResolveUrl(~/img/submit.png)%> /> Should
I'm building a JavaScript based poker game that get some updates from a server
I'm building a javascript-powered gallery on the iPad that can display both images and
I'm creating a building game in JavaScript and PHP that involves a grid. Each
I am building Javascript application for mobile browsers (not wrapped-as-native app). I noticed that
I have a string that I am building via javascript. For the purposes of
I'm building an interactive javascript application that needs to make some SOAP requests to
Looking for a javascript framework that allows to build an online web component that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.