Skip to content
Advertisement

How to run Browser command using jQuery / Javascript?

I have one page in HTML , there are two buttons , save and print.

When user click on the Print it should print the page and
When user click on the Save page it should Open Save as… Box for that page.

Javascript/jQuery solution preferred.

Advertisement

Answer

For printing you can use window.print().

There is no standard way to trigger the Save dialog. In IE you can use document.execCommand('SaveAs').

EDIT: Technically window.print isn’t part of any standard (Source: MDC) but it’s widely available.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement