user1046987
user1046987

Reputation: 113

Reason why window.print() javascript doesnt get previewed in chrome

I have a link in a page which I am using for print the page using window.print(), I want reason why this is not showing preview in Chrome until unless I Add return false in after window.print().

Upvotes: 1

Views: 318

Answers (2)

Selvaraj M A
Selvaraj M A

Reputation: 3136

Try this.

<a href="javascript:window.print();">Print</a>

Upvotes: 0

Samuel Liew
Samuel Liew

Reputation: 79032

return false; prevents the default action taken by the browser. In a link's case, it prevents the link from being followed.

Upvotes: 1

Related Questions