Forum Moderators: open
New question, where could i find code that would allow me to create a print button that would function properly. Also are there options available for automatically customizing the print setup
For instance, i want to be able to have someone hit the print button and it will print the document with a smaller font (the web version uses larger fonts for readability), with no background etc. I know a way around parts of this but ideally i could make it all in a single button with some coding to simplify the process.
The CSS2 recommendation has support for a group of printing controls, but CSS2 doesn't enjoy much browser support at this time. My solution to date has been to create pdf docs for printing.
Maybe someone else will come along who has delved a bit deeper than I have.
<meta name="ROBOTS" content="NOINDEX,NOFOLLOW"></meta>
This will assure that a spider doesn't treat the second page as a mirror of the first and penalize you for spamming.
Not sure if this is what you're after - and it's PC only..but it gives you a "print" button:
<script language="Javascript">
/*
This script is written by Eric (Webcrawl@usa.net)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/
function printit(){
if (window.print) {
window.print() ;
} else {
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = "";
}
}
</script>
<script language="Javascript">
var NS = (navigator.appName == "Netscape");
var VERSION = parseInt(navigator.appVersion);
if (VERSION > 3) {
document.write('<form><input type=button value="Print this Page" name="Print" onClick="printit()"></form>');
}
</script>
Imagine this: suppose that if I could print a page from JavaScript without intervention. Then you hit my web page which on the onLoad starts printing p*rno pictures on your printer. So there certainly can't be a way that can't be restricted by the browser security settings or require user approval to print.
Would SE's ding you for duplicate content/pages? If so would an edit to the robots.txt and a no follow tag on the page help?
Brian
Brian