javascript downlaod document.url code example

Example 1: javascript download file

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

Example 2: what is download api javascript

A browser can have extensions that allow you to download a file
downloads.showDefaultFolder() //Opens the platform's file manager application to show the default downloads folder.
downloads.DownloadQuery // Defines a set of parameters that can be used to search the downloads manager for a specific set of downloads.
downloads.download() // Downloads a file, given its URL and other optional preferences.
downloads.search() //Queries the DownloadItems available in the browser's downloads manager, and returns those that match the specified search criteria.
downloads.getFileIcon() //Retrieves an icon for the specified download.
downloads.open() 		//Opens the downloaded file with its associated application.
downloads.show()		// Opens the platform's file manager application to show the downloaded file in its containing folder.
downloads.drag() //Initiates dragging the downloaded file to another application.