寫在前面
今天的開發遇到了使用window.print()功能進行當前頁面打印的功能,因爲頁腳左邊部分顯示了url,這是不能存在的,已解決,寫在這裏。
正文
很多網上的方法都是不能用的,最後我找到一個使用css控制佈局去掉頁眉頁腳的方法
<style media="print"> @page { size: auto; /* auto is the initial value */ margin: 0mm; /* this affects the margin in the printer settings */ } </style>
最後
親測,谷歌,ie都解決