It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

javascript code for downloading target file

javascript code for downloading target file

Postby nabil9185 on Fri Apr 10, 2009 12:29 pm

hi,

i was looking for a javascript code which would enable straight downloading just by clicking on the link without going the 'right click and save target as' way. like i have this link and i want that when a user clicks on it it goes straight to the option of 'do you want to run or save this file' as we usually have it in the download pages. im in real need of this code so ive u have an idea kindly let me know.

thanks.
nabil9185
 
Posts: 1
Joined: Fri Apr 10, 2009 12:19 pm

Re: javascript code for downloading target file

Postby rangana on Sat Apr 11, 2009 4:10 am

You can actually set the link to open right straight to the page by adding a "target" attribute..which would target to an "iframe" situated on your page.

Might be useful:
Code: Select all
<iframe name="myframe_targ" style="display:none;"></iframe>
<a href="link_to_the_download_page" target="myframe_targ">Download Now!</a>


The iframe needs to be hidden (display:none) so as it wouldn't hamper the layout on your page.

Hope that helps.
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines

Re: javascript code for downloading target file

Postby Suffer on Wed Apr 15, 2009 8:24 am

thanks for sharing knowledge rangana.
Suffer
100+ Club
 
Posts: 236
Joined: Tue Jan 20, 2009 6:34 am


Who is online

Users browsing this forum: No registered users and 3 guests