I have a page that allows the user to draw a signature. The signature is posted to the server as a Base64-encoded PNG. When the user returns to the page, I want the previously drawn signature to be displayed in the same canvas. I have the following CoffeeScript:\[code\]$(document).on('page:load ready', -> signature = new Image() signature.src = http://stackoverflow.com/questions/15590267/$('[name="user[signature]"]').val() $('canvas').get(0).getContext('2d').drawImage(signature, 0, 0))\[/code\]This code works fine when the user enters the URL in the browser and navigates to the page, and when the user navigates around on the website. It fails however when:
- The users refreshes the page by either clicking reload or hitting F5.
- The user is redirected to the page.