Viewing How do I force an HTML snippet to execute?

How do I force an HTML snippet to execute?



User: Daniel B. 11 years ago
As an HTML snippet, I have injected a piece of code to bring up the printer window when you open a new page.

For example, when you click the blue button "PRINT YOUR OFFER" on this page,, it brings up the new page along with the printer interface.

But when you click the blue button "PRINT YOUR OFFER" on this page,, it brings up the new page WITHOUT the printer interface.

The two pages are identical, with the name HTML (Javascript) snippet on both.

What am I missing?

Thank you!

<HTML SNIPPET:>

<script>
window.onload = function() {
window.print();
}
</script>
User: Jumbo T. 11 years ago
Remove the HTML Snippet and paste this code in the Footer Code box of the page.

<script>
$(document).ready(function() {

window.print();

});
</script>

Here you can read the difference :

https://forum.jquery.com/topic/document-ready-and-window-onload-difference
✔ Best Answer  
User: Daniel B. 11 years ago
Perfect! Thank you, sir or madam!


Post Reply
You must login or signup to post.