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 4032986
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:47:25+00:00 2026-05-20T11:47:25+00:00

I got a requirement as following: There is a link on a web page.

  • 0

I got a requirement as following:

There is a link on a web page. As user clicks on link it should create a file on the fly and a download box pops up. How to do it using java script?

  • 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-05-20T11:47:26+00:00Added an answer on May 20, 2026 at 11:47 am

    If the user trusts you, you can can create XML file directly in his filesystem.
    Example code for Mozilla Firefox:

    function mozillaSaveFile(filePath,content)
    {
        if(window.Components) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
                file.initWithPath(filePath);
                if(!file.exists())
                    file.create(0,0664);
                var out = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
                out.init(file,0x20|0x02,00004,null);
                out.write(content,content.length);
                out.flush();
                out.close();
                return true;
            } catch(ex) {
                return false;
            }
        }
        return null;
    }
    

    if you need support for all browsers, see how it is implemented in http://www.tiddlywiki.com

    EDIT: This doesn’t work for Firefox 17+ because changing privileges was deemed unsafe and removed. see here for more details: https://bugzilla.mozilla.org/show_bug.cgi?id=546848#c57

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got the requirement like, In a page there will be 4 panels which
I've got a requirement where a user enters a few terms into a search
We got a requirement to implment following structure of table (It's a sample; data
i've got a problem with the following routes.ini configuration file of my Zend Framework
I've got something like the following XML file. <credits> <property name=tag> <item>v0003</item> </property> <property
I've got the following requirement that works well in the OO space but I
I'm working on a web application. There is one place where the user can
I've got a web app I'm building in ASP.NET that has the following security
I have following requirement for Ad-Integration. I want My app should be populated only
I have a following requirement for a very complex UI. (Complex here means there

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.