How to change/remove "about:blank" at bottom of Print page
How to change/remove "about:blank" at bottom of Print page
GreybeardTheUnready
Posts: 3Questions: 1Answers: 0
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Answers
Link to test case: ??
Thanks @rf1234 - You forced me to do a bit more digging and if you simply try the example provided on the datatables site here
https://datatables.net/extensions/buttons/examples/print/simple.html
You will see "about:blank" in the bottom left of each page if you are using Google Chrome Version 106.0.5249.119,
but not on Opera Version:91.0.4516.65
or Edge Version 106.0.1370.42
and on Firefox Version 105.0.3 "about:blank" appears top right.
So I guess that the actual print service of the browser it inserting it :-(
I'd still like how to control it...
...so the 'about:blank' in Chrome and Firefox footer/header is normally set to the URL of the page being printed (and can't be explicitly set), so I assume that the window that datatables opens doesn't have a URL of its own,
Only solution seems to switch off chrome's print footer.
Correct. That is the header / footer of the browser's printing action. There is no javascript way of controlling that. It is a "feature" of the browser.
Allan
Id like to point out that about:blank can indeed be removed in a regular print dialog via JS as usually printing of content happens via a new document created with open()
= window.open(' ', ' ', 'width=' + '1024px' + ', height=' + '800px');
whereas the first parameters specifies the URL. If no space in between then browser will see URL as "about:blank" and prints in bottom left corner (chrome). IF first param is a blank space then Chrome does not print "about:blank" but sees the URL as a blank space. Following this logic in datatables the print mechanism should be adjustable as to open in a new window as described above.
Will dig a little deeper but not sure this can be achieved via customize().. probably needs some adjustments at code level of datatables.
alright I've had a look and if you change the following code at the datatables print module then about:blank should be removed as per explanation above. please let me know if it works as I have only quickly tested it with latest Chrome:
in
find
and change to
hope this helps!
edit: using quote instead of code as code citation would break on me in preview.
Nice one - thanks for posting back. Does it work without the
width
andheight
parameters? I.e. just provide a single space string as the target name?Allan