Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #30231

Re: OT : min. requirements for printing web page content

Path csiph.com!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: OT : min. requirements for printing web page content
Date Wed, 06 Apr 2016 20:22:01 +0200
Organization PointedEars Software (PES)
Lines 46
Message-ID <1471994.3AEa0WHtAo@PointedEars.de> (permalink)
References <ne1qnb$763$2@dont-email.me> <print-20160406032602@ram.dialup.fu-berlin.de>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1459966922 26145 eJwFwYkBgDAIA8CVwDYBx5En+4/gHQ6dHZfghaCn11tjZg4pBx2OtS+OsqcKmzUlvg5ntH4wwhHv (6 Apr 2016 18:22:02 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Wed, 6 Apr 2016 18:22:02 +0000 (UTC)
User-Agent KNode/4.14.2
X-User-ID eJwNxskBwDAIA7CVSrANGYcc7D9CqpfoMu2AKLDZN20Lplyjl1uTLkbZnC6FMtsP7HzOADALq1C6f2IQJx8mNBQs
Cancel-Lock sha1:p5/22QHkD3odB6AYGGyjN7MSYi4=
X-NNTP-Posting-Host eJwFwQEBwDAIAzBLK6MFO8CPfwlLeAVNuCjncuMfc51Y5CyifMuEbvOr7NIHwYuwPCo0HxXBEIo=
Xref csiph.com comp.lang.javascript:30231

Show key headers only | View raw


Stefan Ram wrote:

> Mike S <mscir@yahoo.com> writes:
>>Iow can I ignore everything but the content I
>>want to print and use html tags to formate it, like maybe just
>>formatting the content in a new div and printing that?
> 
>   Yes. Copy the content to a new window. »w = window.open ...«,
>   »w.write( contents )«, »w.print ...«.

Bad idea, for resource usage and:
 
>   If you have a popup-blocker: Use a custom css for printing,
                  ^^^^^^^^^^^^^
>   which will hide everything but the content.

More precisely, the better idea is to use a *print stylesheet*, one that is 
only triggered if the media is “print”.  This is a CSS feature and is not 
related to scripting.  CSS is on-topic in 
<news:comp.infosystems.www.authoring.stylesheets>.

OP: It is outright rude to start a thread in a newsgroup *knowing or 
assuming* that it is going to be off topic.  You are not going to elicite 
answers this way, not many competent ones at any rate, as you are wasting 
people’s free time.  People have subscribed here because they are interested 
in the topic of *this* newsgroup.  If you have difficulty finding the 
appropriate newsgroup, there are newsgroups like 
<news:news.newusers.questions> where you can ask about that.  You can even 
ask in a newsgroup in which the thread is likely off-topic where it would be 
on-topic.  But it does not work as you did.  Please read the FAQ of this 
newsgroup on how to post properly, and do not do again what you did.

>   Or: Save the old document in a variable. Replace document by
>   content. Print. Restore old document.

Race condition, bad idea.
 
>   In jQuery, see »printElement«.

Worst idea so far, cracking a nut with a hand grenade (*iff* it goes off).

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

OT : min. requirements for printing web page content Mike S <mscir@yahoo.com> - 2016-04-05 19:05 -0700
  Re: OT : min. requirements for printing web page content Mike S <mscir@yahoo.com> - 2016-04-06 00:00 -0700
    Re: OT : min. requirements for printing web page content "Teodor V." <teodor-see-signature@invalid.invalid> - 2016-04-06 11:41 +0200
      Re: OT : min. requirements for printing web page content Aleksandro <aleksandro@gmx.com> - 2016-04-06 10:57 -0300
      Re: OT : min. requirements for printing web page content Mike S <mscir@yahoo.com> - 2016-04-07 23:45 -0700
  Re: OT : min. requirements for printing web page content Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-06 20:22 +0200

csiph-web