I'm trying to print the text inside the div on android chrome
This works on windows 10 chrome
but on android chrome, it prints, but shows the whole page
with header and print button.
Any help appreciated
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function printDiv(divName){
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
docunt.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
</script>
</head>
<h2> Test print </h2>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<body>
<div id="PrintMe" >
<p>
I'm trying to print the text inside the div on android chrome<br>
This works on windows 10 chrome <br>
but on android chrome, it prints, but shows the whole page<br>
with header and print button.
</p>
</div>
<button id="print" onclick= "printDiv('PrintMe')" > Print </button>
</body>
</html>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…