realbasic-nug
[Top] [All Lists]

Re: HTMLViewer: Print a page using javascript

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: HTMLViewer: Print a page using javascript
From: Franck Perez <perez.franck@gmail.com>
Date: Fri, 29 May 2009 22:24:47 +0200
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com; dkim=neutral (body hash did not verify) header.i=@gmail.com
Delivered-to: listarchive@realsoftware.com
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=d+WmfDyNtI7owHFlr1o+Qst0Bo4b+ecrI4aJuxVuPLY=; b=kTXT+KEUnhxFHYuoMBjJ4HUDECFYcIjNmxoOPGRIPep4KqAPbk364C5zB+vh9Nc7i7 UGgSI165I0gxGBm32AOpBPOgi1AUjholQ4UDZ0rJQ0TStSCKVkLxH4nVHeSbKqlG1eHh LUppRUU8vozTqDDsbukhDahFBB0s8+S/Z28UM=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=S6d1k8Za3kOKIxr44SOvd0qEruL+WZeAaDp8Lvf6YtoZp/wYUMd6XsTNVRE+m84Y2q P0qzQ2TlPZRNR8mGaohHXoJKY+7+64jum+3TxVHaEglkHKvL5uvXpiXh+3JqZorLMVsl RhZn6+H4fmthMXN5qNozqa6Y8a4iEIdeO72cU=
In-reply-to: <4a533bec0905290822w4728ca7bw30199388c3454dff@mail.gmail.com>
References: <4a533bec0905290822w4728ca7bw30199388c3454dff@mail.gmail.com>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
User-agent: Postbox 1.0b12 (Macintosh/2009051120)
Great trick. Thanks.
I am not familiar with javascript, so I have 2 questions as a follow-up:
1- is it possible to check that javascript is enabled ? Or to enable it at run-time ? 2- more importantly, how would you copy the the content of a page displayed in an htmlViewer or the source code of the page using the same kind of trick (or any other !) ?

thanks,
Franck.



Carlos M wrote:
For future reference here are some ways using javascript to print a
page with HTMLViewer.

Load a Page:
HTMLViewer1.LoadURL "http://www.example.com";

Print the page using javascript:
(Any of the following works on Windows with an HTMLViewer. Not tested
on MAC, but probably one of the javascript instructions might work)
HTMLViewer1.LoadURL("javascript:void(window.print());")
HTMLViewer1.LoadURL("javascript:window.print();")
HTMLViewer1.LoadURL("javascript:self.print();")
HTMLViewer1.LoadURL("javascript:this.print();")

Note: The browser must have javascript enabled.

Carlos

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>