Search code examples
phpjavascripttextareaautosave

Autosave textarea contents javascript and php


I'm building a very simple text editor for writers as a web app, it's essentially a glorified textarea, but I need it to autosave the content of the text area so the user can leave the page and come back without having to start over. The problem is, I know very little about PHP, but I do know that I'll need it in some form. Any tips/directions/help you can give would be great.


Solution

  • but I need it to autosave the content of the text area so the user can leave the page and come back without having to start over.

    You can do the purpose in php with ajax and session[with storage in database](or cookie) with a token but here's a simpler approach. (assumig you have the client side storage option)

    take a look at sisyphus

    from the intro:

    With Sisyphus on site you just reopen page in your modern (with HTML5 support) browser and see all your changes at that forms. It's lightweight (3.5 KB) jQuery plugin uses Local Storage to prevent your work being lost.

    supported bowsers:

    • Chrome 4+
    • Firefox 3.5+
    • Opera 10.5+
    • Safari 4+
    • IE 8+
    • IE 6 & 7 with jStorage on page loaded before Sisyphus