Print silently in Chrome - javascript

I need to be able to print silently in Chrome. In my ticket system no print dialog can appear, I just wont it to print on my javascript command.
I've done this before in Firefox but now I will change to Chrome as browser.
There is a ticket on this:
https://code.google.com/p/chromium/issues/detail?id=31395#c4
Comment #4 says:
If --kiosk is specified and the preference printing/printer/default is specified, the
print dialog will be skipped.
I have set kiosk mode but dont know where to change the preference printing/printer/default he is talking about? At least it does not exists in my version of Chrome (14.0.835.35 dev-m). But I have a default printer in windows.

For silent printing, you must start Chrome with the --kiosk AND --kiosk-printing flags. This will cause Chrome to display but immediately close the print dialog upon the user attempting to print the page or javascript executing window.print().
Because the print dialog will no longer be available, the printing will automatically use the settings that were last selected in Chrome (or the system default).

The issue you linked to isn't resolved - it is marked as "Available" meaning that it is waiting for some developer to work on it. "printing/printer/default" preference is merely a suggestion for how this feature should be implemented. Comment 4 is about merging a similar issue, not about the actual implementation.

Related

Mozilla firefox debugger not working

When debugger is enabled in firefox by pressing F12 it is disabling the editing feature in the website for which debugger is opened for. Firefox version is 58.0.1
The new UI of firefox is having some problems for me. Once I open the debugger UI cannot do any operations on the web page. Hence went back to old UI by setting the below property to false in browser.
Go to firefox browser. In the address bar type, "about:config". Without the quotes. Search for the below property and toggle it. The value can be toggled(changed) by right clicking or by just clicking on the entry. Set this property to false which takes back to old UI.
property to be altered ==> devtools.debugger.new-debugger-frontend
One of the easiest ways to fix any error is to reset your Firefox under about:support. Lookut for somethin like clean or refresh or reset

Can't open chrome inspector with javascript prompt is running

I'm trying to open the Chrome inspector to see the console log and I can't.
It works very well with Firefox but not with Chrome.
The chrome development tools is enabled and works well when there is no prompt or alert pop up running.
I have a little program in which I have a prompt that asks the user to give a number.
Explanations for the user are in the console(console.log("xxxx")), so when the page is loaded and the prompt is on the screen, the user would have to open the inspector window to see what choice he/she should make.
Here is my code:
console.log("1\n2");
var saisie = prompt("What is your choice");
alert(saisie);
I would like the user to see the console log before they answer the prompt.
You can use window.console to access and interact via javascript with the debug console. Then you can pipe its contents to a div on the page.
alert is blocking, which is why people tell you not to use it (or leave snarky comments to that effect). 'Blocking' means that nothing else can happen: it literally hijacks the entire tab. Meaning that you can't, say, open chrome devtools without dismissing the alert first. I have no idea how this is actually working in FF.
Pro-tip: don't ever use alert. Ever. Use a modal dialog, iframe, whatever. Don't use alert.

How To disable Print Preview feature of Chrome browser using Javascript or c#

I have created an iframe for printing but in chrome it shows print preview and in other browsers it does not show any print preview dialog. So please suggest to me how to disable print preview in chrome.
I have searched this a lot on google but did not find any fix.
I assume you're using Windows. In older versions of Chrome (version 20 & below):
In your browser, navigate to chrome://flags/#print-preview
Click disable to prevent the preview window from appearing.
In newer versions of Chrome (currently on version 47), the above option has been removed, so you must do it through the command line:
Find the shortcut (the Google Chrome icon) you use to open Google Chrome, right click that and select properties - Note you may need to go to Start Menu -> All apps (windows 8-10) -> Programs -> Quick Launch
Add a space, followed by "--disable-print-preview" (without the quotation marks) to the very end of the "Target" textbox, don't remove any of the text that's already there.
Not the most pleasant solutions, but it does work. Hopefully Google will put that option back into the app, as there is cases where it's not practical for it to appear.
If you want to skip both the chrome print preview and windows print preview steps, use the command line "--kiosk-printing". This will quick print, so to speak, to the computers default printer and default settings.
Chrome like to hang around with background tasks so for either of the above options, make sure you relaunch Chrome and restart the machine if necessary.

IE11's F12 developer tools lack option to keep console on navigation

Trying to debug a problem that's IE-11 specific, I would like to see the console messages logged when a certain control is clicked. But the control refreshes the page, which makes F12 tools automatically clear the console, so whatever is logged just before that, I don't get to see!
Past versions of IE had an option to keep the console contents on navigation. Is this option available in IE11? If so, where is it? If not, is there some other way to view the console that doesn't immediately discard the message I want to see?
In with the latest F12 update to IE11 (that came as part of the Win8.1 Update) there is now a button to disable "Clear on Navigate"
Additionally, you can enable IE to record messages in the Console at all times instead of only when the Console is open.
For all the changes to the IE11 F12 dev tools see: http://support.microsoft.com/kb/2929437
Ran into this and I didn't find a good solution, but I found a hacked one that worked well enough for me to debug.
Use window.onbeforeunload to pop up a window so you can at least see the values before they are purged.
See: Prompting and preventing user from navigating away/closing a page

Prevent chrome console from processing javascript until I'm finished writing it

Is there a way I can set up javascripting in Chrome's console so that it does not process my statement as soon as I hit return. If I'm trying to test something out by just writing some javascript there, it processes before I'm done writing.
//here I am writing in the console
if ($(el).size() === 0){
//now I hit return because I want to type some stuff if this evaluates to true
//but return submits it as a finished piece of javascript and of course
//I get SyntaxError: Unexpected end of input before I can have a chance
//to finish the logic
I know I can hit shift+return and get a line break, and though that's a small inconvenience, it's still a bit of an inconvenience. Is there anyway I can tell it to hold off processing until I hit a macro like shift+return?
It's the same way in Firebug. Maybe there's an option there. Or maybe someone knows of a good third party add-on. Thanks.
In the comments I posted the ticket for the request for support, but it has been there for awhile. Chrome does have snipplets, but you have to enable them.
In the address bar type about:flags
Enable Developer Tools experiments
Restart the browser
Open the Developer Tools open the settings menu [gear on bottom right corner]
Click the Experiments tab [on left], check Snippets support
Restart the browser
In the Scripts panel, there will be a Snippets tab, click on it.
Right click on the area below and from context menu select New
You can than Edit and Run the code like a file. Run it with the context menu or play button.
A multi-line console effectively lets you do what you want. Chrome has a request for this but is otherwise not really available.
Firebug Lite for Chrome does allow it. Just click the little red button at the bottom-right of the Javascript console.

Categories

Resources