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).
Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
I laughed that hard I burst my colostomy bag... (\\.\ May03)
Life for some is like a car accident... Mine is like a motorway pile up...
Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?
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 11:05 AM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)