Results 1 to 8 of 8

Thread: Where does VBFORUMS save the "text" of a post when it does that AUTOSAVE??

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Where does VBFORUMS save the "text" of a post when it does that AUTOSAVE??

    So - you know how when you are posting a thread like this - every now and then you see an AUTO-SAVED charm appear in the lower-right corner.

    Where does it save this text?

    I would like to implement something similar in my own web app - so that if an AJAX request to save a big note to the server fails the user can simply recover the last text.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: Where does VBFORUMS save the "text" of a post when it does that AUTOSAVE??

    I'm pretty sure it's in a cookie

    javascript can use cookies, but I can't help with the code

  3. #3

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Where does VBFORUMS save the "text" of a post when it does that AUTOSAVE??

    Thanks for the info.

    I've never done cookies. Anyone have some pointers?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Where does VBFORUMS save the "text" of a post when it does that AUTOSAVE??

    I just checked my cookies for VBF and didnt see any cookies for auto save. I assumed it was saved in the database using AJAX.

    Also doing some research, it seems that Administrators are able to delete everything that is auto-saved from their end, which would point toward database opposed to cookies.

  5. #5
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,605

    Re: Where does VBFORUMS save the "text" of a post when it does that AUTOSAVE??

    I can give you the cookie settings:
    Code:
    function getCookie(c_name) {
        var i, x, y, ARRcookies = document.cookie.split(";");
        for (i = 0; i < ARRcookies.length; i++) {
            x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
            y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
            x = x.replace(/^\s+|\s+$/g, "");
            if (x == c_name) {
                return unescape(y);
            }
        }
    }
    
    
    function setCookie(c_name, value, exdays) {
        var exdate = new Date();
        //exdays = 99;
        exdate.setDate(exdate.getDate() + exdays);
        var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
        document.cookie = c_name + "=" + c_value;
    }
    
    
    function deleteCookie(name) {
        document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
    }
    You can also set them from server side but i guess this is something you wouldn't like
    P.S. Notice the .toUTCString() . This is vital if you want to work with Iexplorer !
    Last edited by sapator; Jul 31st, 2014 at 05:51 AM. Reason: hatred addition for Iexplorer
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  6. #6
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: Where does VBFORUMS save the "text" of a post when it does that AUTOSAVE??

    I would guess it might use LocalStorage. The alternative would be cookies, accessed through document.cookie, but cookies have very low storage space in comparison.

    For data that doesn't need to get sent back to the server, LocalStorage is the way to go. The data should (barring any browser bugs) be restricted-access from the DOM via Same-origin policy, so you can't access LocalStorage data for another domain. Each origin will usually get 5 megabytes of storage space.

    Cookies are transmitted on every request going to-from the server, and that includes all assets (js, css, images, etc.) individually. This is why most large websites retrieve their assets from a separate domain that doesn't set any cookies. Individual cookies are limited to 4 kilobytes data.

    EDIT: dclamp might also be correct with the AJAX auto-saving.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  7. #7
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,605

    Re: Where does VBFORUMS save the "text" of a post when it does that AUTOSAVE??

    Well an IE7 simulator could resolve if localstorage is used.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  8. #8

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Where does VBFORUMS save the "text" of a post when it does that AUTOSAVE??

    Well - I guess I could have seen this myself. I went into FireBug and sure enough after I waited a short bit it did an AJAX POST to save the data.

    My need it to specifically save something locally in case the database/web server is not available for the POST.

    I don't want to save it in a COOKIE it that gets transmitted around - that's no good.

    Is LOCALSTORAGE going to be a problem since it's newer (HTML5?) - will all my clients have access to this?
    Attached Images Attached Images  

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width