Click here to Skip to main content
15,906,625 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
When I try to put a simple script of "print("any")", the web opens the printer, I don't know why.

What I have tried:

I updated the drivers, etc. my Windows is the free version.
Updated 4-Oct-23 9:17am
Dave Kreskowiak 4-Oct-23 10:44am    
You're going to have to supply a LOT more detail than this. At least show the code and describe what you expect to happen and what is happening.

The print function in javascript prints the current web page, but you have to go through the Print Preview dialog first. It does NOT print whatever you supply as an argument, so there is no way to print any arbitrary text. This is for security reasons.
Share this answer
As Dave said, the print() method[^] prints the current webpage.

If you're looking to output text to the developer console then consider using the console.log() method[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900