Smart questions
Smart answers
Smart people
Join Tek-Tips Forums
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

jebo100 (TechnicalUser) (OP)
29 May 08 2:53


<a href="" onclick="Javascript: window.print()">Print this page</a>

the above prints the current page.

is there a way to save the current page to my local hard drive?
ex:
<a href="" onclick="Javascript: window.Save????()">Save this page</a>

thanks....


  

JEBO
4saledavao

BillyRayPreachersSon (Programmer)
29 May 08 17:20

Investigate "execCommand" - although it's only supported by IE, as far as I know.

Hope this helps,
Dan

 

Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page @ Code Couch
http://www.codecouch.com/dan/


 

jebo100 (TechnicalUser) (OP)
29 May 08 23:35


i have tried "execCommand".
but i needed it to work with other browsers too.

thanks a lot for your reply...
 

JEBO
4saledavao

BillyRayPreachersSon (Programmer)
30 May 08 2:22

Then you're out of luck, I'd say, if you want this to be automatic.

Dan

 

Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page @ Code Couch
http://www.codecouch.com/dan/


 

jebo100 (TechnicalUser) (OP)
30 May 08 3:09
thanks ...
 

JEBO
4saledavao

tsuji (TechnicalUser)
1 Jun 08 3:17
This is how you do it cross-browser. On the moz-based block, you might need to know a bit of xul to understand in order to script; but operational-wise it does not need any knowledge of it. It just differs from ie now by asking explicitly the xpconnect privilege from the user. The user can deny it, sure. It can be granted on one-time-basis. (Do not click on the remember checkbox and you're remaining safe.) The reason is that by default that privilege is denied (for good reason, and I am not suggesting to switch it permanently to allow.)

The demo is no-nonsense free from artificial irrelevance and well-focused.

<html>
<head>
<title>xbs_saveas_gt</title>
<script type="text/javascript">
function go_saveas() {
    if (!!window.ActiveXObject) {
        document.execCommand("SaveAs");
    } else if (!!window.netscape) {
        var r=document.createRange();
        r.setStartBefore(document.getElementsByTagName("head")[0]);
        var oscript=r.createContextualFragment('<script id="scriptid" type="application/x-javascript" src="chrome://global/content/contentAreaUtils.js"><\/script>');
        document.body.appendChild(oscript);
        r=null;
        try {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            saveDocument(document);
        } catch (e) {
            //no further notice as user explicitly denied the privilege
        } finally {
            var oscript=document.getElementById("scriptid");    //re-defined
            oscript.parentNode.removeChild(oscript);
        }
    }
}
</script>
</head>
<body>
<a href="#" onclick="go_saveas();return false">save the document</a><br />
</body>
</html>

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close