program tip

인쇄 페이지에서 URL을 제거하는 방법은 무엇입니까?

radiobox 2020. 9. 1. 07:24
반응형

인쇄 페이지에서 URL을 제거하는 방법은 무엇입니까?


페이지 하단에 인쇄되는 URL을 삭제하고 싶습니다.

처럼:

yomari.com/.../main.php?sen_n

어떻게 생략하거나 인쇄를 방지 할 수 있습니까?

더 구체적으로 말하면 웹 페이지를 인쇄하는 동안 페이지 URL, 날짜 및 페이지 제목이 함께 인쇄되는 것을 방지 할 수있는 방법이 있습니까?


다음 코드 샘플이 작동합니다.

<style type="text/css" media="print">
@page {
    size: auto;   /* auto is the initial value */
    margin: 0;  /* this affects the margin in the printer settings */
}
</style>

페이지에서 브라우저 인쇄 옵션 (머리글, 바닥 글, 여백) 비활성화 에 대한 답변을 참조하십시오.

@page의 사양


브라우저 측 자체에서 뭔가를 찾았습니다.

이 단계를 시도하십시오. 여기에서는 세 가지 주요 브라우저 모두에서 머리글과 바닥 글을 비활성화하는 단계에 대해 언급했습니다.

Chrome 브라우저의 오른쪽 상단에있는 메뉴 아이콘을 클릭합니다. 인쇄를 클릭합니다. 옵션 섹션에서 머리글 및 바닥 글을 선택 취소합니다.

Firefox 브라우저의 왼쪽 상단에서 Firefox를 클릭합니다. 인쇄 위에 마우스를 놓고 페이지 설정을 클릭합니다. 여백 및 머리글 / 바닥 글 탭을 클릭합니다. 머리글 및 바닥 글 아래의 각 값을 --blank--로 변경합니다.

Internet Explorer 브라우저 오른쪽 상단의 톱니 바퀴 아이콘을 클릭합니다. 인쇄 위에 마우스를 놓고 페이지 설정을 클릭합니다. 머리글 및 바닥 글 아래의 각 값을 -Empty-로 변경합니다.


URL을 표시하는 것은 브라우저 클라이언트 기본 설정이며 페이지 내에서 실행되는 스크립트에 액세스 할 수 없습니다 (페이지가 자동으로 인쇄 될 수도 없습니다).

쿼리 문자열을 통한 정보 "누출"을 방지하려면 POST를 통해 제출할 수 있습니다.


Mozilla Firefox에 대해 이야기하고 있습니다 (다른 브라우저에서도 동일하게 사용되기를 바랍니다).

를 클릭 Firefox 메뉴 , 이동하는 인쇄 선택, 페이지 설정까지 인쇄의 하위 메뉴에서. 화면에 팝업이 나타나면 "Margin & Header / Footer" 탭으로 이동합니다.

인쇄하기 전에 요구 사항에 따라 머리글 / 바닥 글에 대해 "BLANK"선택 합니다. 확인을 위해 미리보기를 확인할 수 있습니다.

이것이 도움이되기를 바랍니다.


머리글과 바닥 글 아래의 코드를 사용하여 페이지 여백을 설정하면 인쇄 된 페이지에서 생략됩니다. FireFox와 Chrome에서 이것을 테스트했습니다.

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

도움이되었습니다 : 링크없이 페이지 인쇄

@media print {
    a[href]:after {
        content: none !important;
    }
}

브라우저 설정을 통해 인쇄 된 문서에서 표시되는 URL을 제거 할 수 있습니다. 파일-> 페이지 설정-> 머리글 및 바닥 글을 클릭하면 모든 항목이 공백으로 설정됩니다. 즉, 바닥 글 텍스트 상자에서 & U를 제거합니다. 도와 줘


실제 그래픽 내의 바닥 글 또는 브라우저 내의 인쇄 프로세스가 수행하는 URL에 대해 이야기하고 있는지 모르겠습니다.

URL이 있으면 인쇄 프로세스가 브라우저를 끄는 기능이 있으면 실제로 브라우저에 달려 있습니다.

바닥 글 정보라면 인쇄 스타일 시트를 사용하고 해당 스타일 시트 내에서 수행하는 것이 좋습니다.

display: none;

바닥 글의 특정 ID 또는 클래스 용.

스타일 시트를 인쇄하려면 이것을 헤드에 추가해야합니다.

<link rel="stylesheet" type="text/css" href="/css/print.css" media="print" />

In Google Chrome, this can be done by setting the margins to 0, or if it prints funky, then adjusting it just enough to push the unwanted text to the non-printable areas of the page. I tried it and it works :D

enter image description here


Nowadays, you can use history API to modify the URL before print, then change back:

var curURL = window.location.href;
history.replaceState(history.state, '', '/');
window.print();
history.replaceState(history.state, '', curURL);

But you need to make a custom PRINT button for user to click.


I would agree with most of the answers saying that its a browser settings but still you can achieve what you want via COM. Keep in mind that most browsers will still have issue with that and even IE will raise the COM security bar to users. So unless its not something you are offering within organisation, don't do it.


I have the same problem. I wonder if it is possible to create the HTML for printing via a jquery plugin: http://www.recoding.it/?p=138

Then send the HTML to a php script (using an ajax call), generate a pdf with http://www.xhtml2pdf.com/ or http://code.google.com/p/wkhtmltopdf/.

Afterwards the pdf could be displayed (by setting the appropriate content type and direct rendering) or displayed by a http-Redirect to the generated pdf.

The generated pdfs in the pfd_for_printing-folder could act as cache and be deleted by a job once a day.


On Chrome 57 the following worked for me, if you have control of the HTML page that needs to be printed (in my case I needed to print a small 3x1 inch label):

  • remove the HTML title element from header (either temporarily using jquery or permanently if that page does not really need a title)
  • set the @page margin to 0 as mentioned by @Chamika Sandamal

This resulted in printing a page that only contained the body text, no URLs, no page #s etc.


Browser issue but can be solved by these:

<style type="text/css" media="print">
      @media print
      {
         @page {
           margin-top: 0;
           margin-bottom: 0;
         }
         body  {
           padding-top: 72px;
           padding-bottom: 72px ;
         }
      } 
</style>

<style type="text/css" media="print">
  @page {
    size: auto;  
    margin: 0;  
  }
</style>
//now set manual padding to body
<style>
  body{
    padding-left: 1.3cm;
    padding-right: 1.3cm; 
    padding-top: 1.1cm;
  }
</style>

@media print { a[href]:after { content: none !important; } }

This will be the simplest solution. I tried most of the solutions in the internet but only this helped me.

@print {
    @page :footer {
        display: none
    }

    @page :header {
        display: none
    }
}

Perhaps you could try chrome (Probably Safari also)

The url & the page number in the header & footer is not visible when I print to pdf on OSX with Google Chrome.

Sorry not sure if this applies to windows


I have a trick to remove it from the print page in Firefox. Use this:

<html moznomarginboxes mozdisallowselectionprint>

In the html tag you have to use moznomarginboxes mozdisallowselectionprint. I am sure it will help you a lot.


@media print {
    #Header, #Footer { display: none !important; }
}

Check this link


Well, i searched all the way up and down because i needed the answer for me and my projects, and came to a conclusion that, actualy no matter what information you show in the url adress its up to:

if (!$_SESSION["valid_user"]) 

So even if someone just type the exact adress from your printed page he would get .... Login page :)

참고URL : https://stackoverflow.com/questions/585254/how-to-remove-the-url-from-the-printing-page

반응형