/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Force Save As

I am trying to force the Save As window to pop up.

I have a link to a .epub file which is not recognized by the browser so shows as “page cannot be found” when clicked.

I would like Save As box appear when you click on the link.

in my header i have

[code=html]<script type=”text/javascript”>
function save(){
str = document.forms[0].input.value;
mydoc = window.open();
mydoc.document.write(str);
mydoc.document.execCommand(“saveAs”,true,”.html”);
mydoc.close();
return false;
}
</script>
[/code]

and on my link I have

[code=html]<a href=”files/DM_EmailAutoBulkFiling.epub” onclick=”save()”>Click Here</a>[/code]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@toicontienFeb 26.2011 — You'll need to enforce this on the server side. Maybe try this? http://imar.spaanjaars.com/189/howto-force-the-save-as-dialog-in-the-browser

Or search google.
Copy linkTweet thisAlerts:
@beylahauthorFeb 28.2011 — i will do a google search but the link you gave me is for asp - the code i have is javascript and the page is doen in php
Copy linkTweet thisAlerts:
@toicontienMar 02.2011 — Searching for force download php should give you something to go on.
Copy linkTweet thisAlerts:
@beylahauthorMar 18.2011 — the code is correct - what needs to be done is the server needs to be set to understand what to do for that file type.
×

Success!

Help @beylah spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...