I have been asked if I could make a small piece of code that would download a specific file off a website automatically, however as I have little to no background in web dev I was wondering if someone could please help? I trowled through google a bit and didn't find anything relating specifically to what I need to do so here I am.
Basically I have been asked to download the file on this website, when you press the "Export" button in the right hand side and then the "Export" button on the form that appears which then initates a download of the file "PracticeProfiles.xls".
I had a look at the wesite and this file seems to be generated as oposed to having a hard link somewhere to it on the server (I may be wrong).
Please remember to wrap any code you have in forum tags:-
[CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]
If you can't think outside the box, you will be trapped forever with no escape...
You have to append it to body or Firefox and Chrome ignores it, though "real" Opera and IE will obey it without the appendChild... Since it has no text in it, the appendChild is usually safe... though you might want to detect if you already have one so if there are multiple downloads you don't fill up the DOM with empty anchors.
var a = d.body.appendChild(d.createElement('a'));
Last edited by deathshadow; 06-01-2014 at 10:05 AM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)