๐ŸŒ
javascript.com
javascript.com
Learn JavaScript Online - Courses for Beginners - javascript.com
JavaScript.com is a resource for the JavaScript community. You will find resources and examples for JavaScript beginners as well as support for JavaScript experts. Learn JavaScript or free with our easy to use input output machine.
Try JavaScript
Start learning JavaScript with our interactive simulator for free. Our easy to follow JavaScript tutorials for beginners will have you coding the basics in no time.
JavaScript Strings
Learn the basics of JavaScript Strings with code examples and small tutorials and descriptions on how each string function and method works.
๐ŸŒ
Microsoft Store
apps.microsoft.com โ€บ detail โ€บ 9pn0v3g6pgh5
JavaScript - Java Script Programming - Free download and install on Windows | Microsoft Store
If you want to learn programming but donโ€™t know how to start, our app JavaScript Coding will help you! It includes various Java lessons for beginners which will help you to understand the basics of coding. After each lesson you can complete a task to test knowledge and run the code to see ...
๐ŸŒ
RunJS
runjs.app โ€บ play
RunJS - JavaScript Playground | Run JavaScript Online
An easy-to-use online JavaScript playground with live feedback. Write and run JavaScript instantly. Great for learning and prototyping.
๐ŸŒ
Playcode
playcode.io
JavaScript Playground - Free Online JS Sandbox
The #1 JavaScript playground to write, run and test code instantly. Free JS sandbox with live preview, npm packages, and AI coding assistant. No setup required.
๐ŸŒ
Softonic
en.softonic.com โ€บ downloads โ€บ javascript
Download Javascript - Best Software & Apps
Download Javascript. Free and safe download. Download the latest version of the top software, games, programs and apps in 2025.
๐ŸŒ
freeCodeCamp
forum.freecodecamp.org โ€บ javascript
JavaScript where to download? - JavaScript - The freeCodeCamp Forum
December 30, 2017 - So, i want to download javascript to my computer to code there, but i cant find any normal downloader w/ it. Can u help me guys?
๐ŸŒ
Node.js
nodejs.org โ€บ en
Node.js โ€” Run JavaScript Everywhere
Node.jsยฎ is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts.
๐ŸŒ
JSFiddle
jsfiddle.net
JSFiddle - Code Playground
JSFiddle - Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle.
Top answer
1 of 16
439

Use an invisible <iframe>:

<iframe id="my_iframe" style="display:none;"></iframe>
<script>
function Download(url) {
    document.getElementById('my_iframe').src = url;
};
</script>

To force the browser to download a file it would otherwise be capable of rendering (such as HTML or text files), you need the server to set the file's MIME Type to a nonsensical value, such as application/x-please-download-me or alternatively application/octet-stream, which is used for arbitrary binary data.

If you only want to open it in a new tab, the only way to do this is for the user to a click on a link with its target attribute set to _blank.

In jQuery:

$('a#someID').attr({target: '_blank', 
                    href  : 'http://localhost/directory/file.pdf'});

Whenever that link is clicked, it will download the file in a new tab/window.

2 of 16
377

2019 modern browsers update

This is the approach I'd now recommend with a few caveats:

  • A relatively modern browser is required
  • If the file is expected to be very large you should likely do something similar to the original approach (iframe and cookie) because some of the below operations could likely consume system memory at least as large as the file being downloaded and/or other interesting CPU side effects.

fetch('https://jsonplaceholder.typicode.com/todos/1')
   // check to make sure you didn't have an unexpected failure (may need to check other things here depending on use case / backend)
  .then(resp => resp.status === 200 ? resp.blob() : Promise.reject('something went wrong'))
  .then(blob => {
    const url = window.URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.style.display = 'none';
    a.href = url;
    // the filename you want
    a.download = 'todo-1.json';
    document.body.appendChild(a);
    a.click();
    window.URL.revokeObjectURL(url);
    // or you know, something with better UX...
    alert('your file has downloaded!'); 
  })
  .catch(() => alert('oh no!'));

2012 original jQuery/iframe/cookie based approach

I have created the jQuery File Download plugin (Demo) (GitHub) which could also help with your situation. It works pretty similarly with an iframe but has some cool features that I have found quite handy:

  • Very easy to setup with nice visuals (jQuery UI Dialog, but not required), everything is tested too

  • User never leaves the same page they initiated a file download from. This feature is becoming crucial for modern web applications

  • successCallback and failCallback functions allow for you to be explicit about what the user sees in either situation

  • In conjunction with jQuery UI a developer can easily show a modal telling the user that a file download is occurring, disband the modal after the download starts or even inform the user in a friendly manner that an error has occurred. See the Demo for an example of this.

Here is a simple use case demo using the plugin source with promises. The demo page includes many other, 'better UX' examples as well.

$.fileDownload('some/file.pdf')
    .done(function () { alert('File download a success!'); })
    .fail(function () { alert('File download failed!'); });
Find elsewhere
๐ŸŒ
RunJS
runjs.app
RunJS - JavaScript and TypeScript Playground for macOS, Windows and Linux
Download RunJSOther platforms ยท Latest version: 3.2.2 ยท Get previous versions ยท Exploring JavaScript has never been easier. Live feedback as you type, with per-line results makes it super clear what your code is doing. With RunJS you have access to Node.js and Browser APIs, including full DOM access.
๐ŸŒ
Programiz
programiz.com โ€บ javascript โ€บ online-compiler
Online JavaScript Compiler (Editor) - Programiz
// Online Javascript Editor for free // Write, Edit and Run your Javascript code using JS Online Compiler console.log("Try programiz.pro");
๐ŸŒ
Softonic
en.softonic.com โ€บ downloads โ€บ javascript-for-windows
Download Javascript For Windows - Best Software & Apps
Download Javascript For Windows. Free and safe download. Download the latest version of the top software, games, programs and apps in 2025.
๐ŸŒ
JS Bin
jsbin.com
JS Bin - Collaborative JavaScript Debugging
JavaScript ES6 / Babel JSX (React) CoffeeScript Traceur TypeScript Processing LiveScript ClojureScript Convert to JavaScript ยท Processor ยท CSS Less Myth Sass with Compass SCSS with Compass Stylus Convert to CSS ยท Console Run Clear ยท Output Run with JS Auto-run JS ยท You can jump to the latest bin by adding /latest to your URL Dismiss x ยท Transfer ยท Clone ยท Save as template ยท Export gist ยท Download ยท
๐ŸŒ
Soft112
free-javascript-editor.soft112.com
Free JavaScript Editor 4.7 Free Download
Free JavaScript Editor is a great help for amateur web designers but I suspect it can also live up to higher expectations if the experts in questions aren't keen on parting with some shekels, be it fifty or more.
๐ŸŒ
FileHorse
filehorse.com โ€บ windows โ€บ developer tools
JavaScript Editor Download (2025 Latest)
Download JavaScript Editor for Windows PC from FileHorse. Safe and Secure. Create professional apps, demos or great web things with javascript editor!.
๐ŸŒ
OneCompiler
onecompiler.com โ€บ javascript
JavaScript Online Compiler & Interpreter
Write, Run & Share Javascript code online using OneCompiler's JS online compiler for free. It's one of the robust, feature-rich online compilers for Javascript language. Getting started with the OneCompiler's Javascript editor is easy and fast.
๐ŸŒ
Playcode
playcode.io โ€บ online-javascript-editor
Playcode
The #1 JavaScript playground to write, run and test code instantly. Free JS sandbox with live preview, npm packages, and AI coding assistant. No setup required.
๐ŸŒ
CNET
download.cnet.com โ€บ free-javascript-editor โ€บ 3000-10248_4-10907077.html
Free JavaScript Editor for Windows - Free download and software reviews - CNET Download
November 7, 2018 - Download Free JavaScript Editor latest version for Windows free. Free JavaScript Editor latest update: November 7, 2018
Rating: 3.2 โ€‹ - โ€‹ 12 votes