943,993 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Aug 25th, 2005
1

Save Target as...

Expand Post »
How do I make a button that will bring up the download box for something on my website, without the user having to right-click and select "Save Target as..."
Thanks
:lol: Martin :lol:
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster
martinkorner is offline Offline
102 posts
since Aug 2005
Aug 25th, 2005
0

Re: Save Target as...

You can't. This is fundamental "user interface" 101. A programmer shouldn't attempt to force actions that are historically under user control. Also, what you're attempting violates the browser security model. Just imagine the havoc that would be caused if a web page could "silently download" anything as soon as you browse to it.

I understand you simply want the dialog to pop up, but it's still not allowed.
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Aug 26th, 2005
0

Re: Save Target as...

Oh well...
Thanks anyway
Reputation Points: 10
Solved Threads: 0
Junior Poster
martinkorner is offline Offline
102 posts
since Aug 2005
Sep 27th, 2005
0

Re: Save Target as...

The future is web applications, and needs to provide the same capabilities as a WinForms, if the developer deems so. 90% of my sites are intranet based, so I do not have the fear of anonymous users. If you are using the .NET framework you have some options. You have the ability to create a server-side method or page dedicated to writing the document to the response stream. This will cause the parent page to postback, but it will prompt for download. If you are looking to do this without postback you this can achieved using AjaxPro, http://ajaxpro.schwarz-interactive.de, or other any other Ajax frameworks.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
akadez is offline Offline
8 posts
since Sep 2005
Oct 1st, 2005
0

Re: Save Target as...

What ??? - sorry I'm not with that at all can you explain again please?

Martin

P.S. I wanted to make a link on my website so that when someone clicked on it a .zip file would download - to save them right clicking and clicking on "Save Target as..." etc.
Reputation Points: 10
Solved Threads: 0
Junior Poster
martinkorner is offline Offline
102 posts
since Aug 2005
Oct 1st, 2005
0

Re: Save Target as...

It can't be done with HTML, CSS or JavaScript, the topics covered in this forum. What akadez is referring to are some possible techniques in ASP.NET, a server-side language. Daniweb has an ASP.NET forum, if you code in that language.
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Nov 6th, 2005
0

Re: Save Target as...

Most of your visitors will have .zip files set to offer as download rather than process automatically so you could upload in that format. There is also code that can be put in the .htaccess file to force what you want if your site is running on an apache server.
Reputation Points: 13
Solved Threads: 1
Junior Poster in Training
felgall is offline Offline
50 posts
since Aug 2004
Nov 9th, 2005
0

Re: Save Target as...

Quote originally posted by tgreer ...
You can't. This is fundamental "user interface" 101. A programmer shouldn't attempt to force actions that are historically under user control. Also, what you're attempting violates the browser security model. Just imagine the havoc that would be caused if a web page could "silently download" anything as soon as you browse to it.

I understand you simply want the dialog to pop up, but it's still not allowed.
Excuse me but the idiot has arrived :o with a question about your answer. Pages seem to download a lot of crap onto my machine when I browse the internet. I have gotten worms, spyware, and other malicious stuff without ever asking for it nor agreeing to it. *thinks I need to hide under the bed now as you are all probably dying laughing* but I really want to know. When you stop laughing at me will you please explain this to me? :rolleyes:
Reputation Points: 10
Solved Threads: 1
Light Poster
Bomba is offline Offline
32 posts
since Oct 2005
Nov 9th, 2005
0

Re: Save Target as...

I don't mind the question, but you're asking it in the wrong spot! Daniweb has a forum specifically for these types of issues: http://www.daniweb.com/techtalkforums/forum64.html

If you'll peruse that forum, I think you'll get the education you seek! If not, feel free to post a new thread there. No one will bite your head off; we try to be a friendly group.
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Nov 10th, 2005
0

Re: Save Target as...

Wait wait wait ... what is being asked is a client-side technology, not server-side at all ... Anything that would interact directly with the web browser - such as opening a dialog menu, would have to be a client-side script.

Server side scripts can interact with files on the server, but you need something client side to interact with files or applications (in this case, the web browser) on the client side of things.

I think this could be accomplished in DHTML (although I'm not sure specifically how to go about it), can it not?
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: form event problem
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Problem in hovering





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC