My web system has print invoice function. I need to prevent the user from:
- Editing the invoice in a web browser (F12)
- Saving the invoice to local
Please give me some solutions. My invoice is render in html.
My web system has print invoice function. I need to prevent the user from:
Please give me some solutions. My invoice is render in html.
Editing the invoice in a web browser (F12)
Using "browser hacks" to disable a web browser's developer tools, to prevent users from editing the invoice for their own purpose is not a sound strategy. The code that would otherwise block or limit the use of the developer tools keeps changing as browsers are updated.
But, if your still interested in pursuing this path, have a look at this question: How does Facebook disable the browser's integrated Developer Tools?.
Saving the invoice to local
Acknowledging that everything viewed on browser, had to be downloaded in the first place to be viewed.
You can't really stop users from saving a copy of the invoice, you can however, make it harder for regular users to save a copy to their documents folder or other folder they choose for that matter.
Anyway, assuming you can make the invoices available in PDF format, have you considered using the embeddable Google document viewer?
It allows you to view a number of documents within the confines of a web browser, sorry I cannot find the documentation online, but its usage is pretty straightforward.
<iframe src="//docs.google.com/gview?url=http://example.com/invoice/123.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>
Replace http://example.com/invoice/123.pdf
with the URL to the particular invoice.
This would allow users to view the invoice, yet prevent normal users from editing and/or saving it for later use.
However, it wouldn't prevent a user with the same knowledge required to make of use of the developer tools, from viewing the source and grabbing the URL for the invoice from the source of that iframe.