Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Automatic printing from /any/ browser

Posted on 1999-07-21
13
Medium Priority
?
318 Views
Last Modified: 2012-06-27
How can I automatically (Onload) print the current document, no matter which browser (IE3.x/4.x/5.X/NS ditto) the cleint is using? I know about the window.print() or print() function of NS, but how can I use anything equivalent on the IE?
0
Comment
Question by:jwiebe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +2
13 Comments
 
LVL 3

Expert Comment

by:davlun20080
ID: 1826650
This is from active question in javascript area, see http://www.experts-exchange.com/Computers/Programming/Languages/JavaScript/Q.10183680

<HEAD>
<TITLE>Test</TITLE>
<object id=WBControl width=0 height=0
classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2>
</object>
<SCRIPT LANGUAGE=VBScript><!-- //
Sub VBPrint() On Error Resume Next
WBControl.ExecWB 6,1
End Sub
// --></SCRIPT>
<SCRIPT LANGUAGE=JavaScript><!-- //
function startprint(){
if (window.print)
   self.print();
else if (navigator.appName.indexOf('Microsoft') !=-1)
   VBPrint(); }
// --></SCRIPT>
</head>
<body onLoad="startprint()">

This did not work for me in NS but you get the idea, perhaps your questions would be better served in the JS area.

davlun
0
 

Author Comment

by:jwiebe
ID: 1826651
Thanx, sorry about placing the question here... newbie...
0
 
LVL 3

Expert Comment

by:davlun20080
ID: 1826652
Hope I did not offend, did not mean to if I did.  Just wanted to make sure you obtained the best answer possible.  Could not offer more on the script myself, best I can do.

davlun
0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 
LVL 7

Expert Comment

by:nettrom
ID: 1826653
window.print() is available in Netscape 4.x and IE5.  IE4 can use the print.js metioned in the question you got a link to.  for IE3 (and also IE4) you can use a script found on irt.org, URL is http://www.irt.org/script/481.htm

to figure out what browsers you're talking to you'll have to do a bit of browser sniffing.
0
 
LVL 4

Accepted Solution

by:
komandur earned 400 total points
ID: 1826654
I have 2 choices for you.

a) Netscape /Print(<yourHTMfile>) - By running this command netscape will load & print your file.

b) This needs registry editing. Copy what netscape parameter are for "print" to "open" - This will print the document automatically when you double-click (ie., by default).

hope this helps.

kannan.

0
 
LVL 3

Expert Comment

by:davlun20080
ID: 1826655
Komandur,
I know this isn't my question, but does your answer mean it will print from the users browser the minute the page loads or from jwiebe's pc when he double clicks on a file?  Because if all it takes to print is getting the command netscape /print -- how do you add that to a web page?  Secondly, will this work on older browsers and IE?

Sorry to intrude jwiebe, I am REALLY interested in this question as it is something that I have thought about before.

davlun
0
 

Author Comment

by:jwiebe
ID: 1826656
Ok, if you want to print a page upon loading just add onLoad="javascript:print()" into your <body>-tag. this works with pretty much all NSs and it's upposed to work with IE5.
I wanted to get a solution that works for both, IE (4) and NS, for this, try the link mentioned above (with didn't work for me :-( ).

jwiebe


0
 
LVL 3

Expert Comment

by:davlun20080
ID: 1826657
Thanks Jwiebe, I knew about the print() but it seemed Komandur had a different solution than that.  Just thought I would check to make sure I was following the thread right.  I do know that the script from the javascript area answered by mplungjan does work for ie.  But it sure would be nice to be able to print onload for both (especially with no prompts.
davlun
0
 
LVL 4

Expert Comment

by:komandur
ID: 1826658
Davlun,

Yes by using my method(b) you can make _any_ 'html' file automatically printed by double clicking on it. Basically all I am trying to do is change the command of "open" to "print". This will not work unattended in IE since it expects you to press OK on the print dialog box. Whereas Netscape does a neat job on this front.

kannan.

0
 
LVL 7

Expert Comment

by:nettrom
ID: 1826659
hmmm... I can't really understand how the registry editing et all will answer the question here.  it'll make an HTML page when double-clicked from Explorer print, but is that really what's wanted here?

I hope jwiebe could clarift a bit.
0
 
LVL 3

Expert Comment

by:davlun20080
ID: 1826660
Now nettrom's comments are a little in line with what I was thinking at first, but for some reason I thought what was proposed would work from browser.  Jwiebe, what is it you are trying to do, automatically print a page being viewed by a user or print by double-clicking from explorer.

davlun
0
 
LVL 4

Expert Comment

by:komandur
ID: 1826661
Reading his original question again it says "onload" printing only. Since he has not accepted the proposed "onload", I have given the other choices.

kannan.

0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6872708
GREETINGS!

This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently found myself in a Corporate Situation where the client had requested blocking access to any and all websites except his own Domain? Easy? I am sure this would be your answer but their requirement was, this has to be done without using…
Several part series to implement Internet Explorer 11 Enterprise Mode
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question