javascript - 如何在jquery中自动打印时删除不需要的内容,例如url

标签 javascript html jquery

我正在尝试使用 jQuery 自动打印我的页面。但问题是出现红点圆圈。那么如何删除它们?3

这是我的 html 文件,看起来像

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
   
    <title>Document</title>
</head>
<body>
<div>
    Hello From Other side
</div>



<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

<script>
    window.onload = function () {
        window.print();
    }
</script>
</body>
</html>

所以我想删除那个红点圆圈部分,例如网址名称和标题名称。

enter image description here

最佳答案

请通过此链接尝试此操作 How to remove the URL from the printing page?

   <style media="print">
        @page {
            size: auto;
            margin: 0;
        }
    </style>

关于javascript - 如何在jquery中自动打印时删除不需要的内容,例如url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65665752/

相关文章:

javascript - 如何在 Chrome 自动完成时获取输入值

javascript - 使用 jquery 进行验证的常用函数

javascript - 如何检查我的数据库是否已更改?

c# - 使用javascript启用文本框

html - 在侧边栏上,如何使二级菜单在一级菜单旁边打开?

javascript - 如何使用 Javascript 中的 execCommand 将 "id"设置为标签?

javascript - <a href 中的 onClick 导致 Uncaught ReferenceError : $ is not defined?

javascript - 在Angular js中编写回调函数

php - 将 var 从 php 传递到 javascript

javascript - 尝试将表单连接到数据库时,我收到 : firebase. 数据库不是函数错误