Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4243236
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:33:05+00:00 2026-05-21T03:33:05+00:00

What would be the better path to take if I were in need of

  • 0

What would be the better path to take if I were in need of storing dynamically created content, which when inserted into the page, will have a pre-defined position within a container?

To make it a little more simpler to understand, say a user types something into an input box, which turns out to be a YouTube URL. Once he/she hits enter I take the URL and create an embedded video and add it to the page within a container of class name box. This is the dynamic content.

This box can also be dragged using jQuery-ui, so the position will not always be the same. Now if I were to reload the page, I need the page to look exactly as it did before it reloaded, including the position and dynamically created content by the user.

I understand there are probably a number of ways to do such a thing, but there are limitations. Because there is no server available to store this information with, I am limited to using:

  • localStorage
  • Web SQLite

It’s also worth mentioning that this will be used in a Google Chrome Extension.

So my question is, what would be the best way to store this kind of information given the limitations?

Example with what I’m working with here: http://fiddle.jshell.net/Shaz/pfs8a/30/show/light/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T03:33:06+00:00Added an answer on May 21, 2026 at 3:33 am
    function contentHash(domNode) {
        ... // return unique id based on content / dom node.
    }
    
    var myUniqueSalt = ... // unique salt for your unique id's
    
    window.localStorage.setItem(uniqueSalt + contentHash(domNode), "{'x':" + x + ",'y':" + y "}");
    
    ...
    
    var position = JSON.parse(window.localStorage.getItem(uniqueSalt + contentHash(domNode));
    
    object.x = position.x;
    object.y = position.y;
    

    Something along those lines should suffice.

    You want a unique salt to ensure no-one overwrites your location in localStorage and then you want to get a unique id from your content that your storing the position.

    Simply store the position as a JSON string then use JSON.parse to get your position object later.

    of course check for whether the getItem returns an empty string and if so use the default.

    I’ll go even further to recommend you use backbone.js to store your data and connect it upto backbone.js-localstorage. Which overwrites the backbone.sync method so the models are saved locally.

    This means you don’t have to serialize your data into localstorage nor serialize it out of local storage.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am curious which one would be better fitting as a currency field ?
I would like to better understand the basic steps needed to a take an
I have Python classes, of which I need only one instance at runtime, so
I have a need to execute a batch file when I drop it into
I have an application which pulls XAML page paths from a database. I can
What would be better for presenting a results table within an Android application where
Seems like it would be better if you did commit followed by merge. I'm
For performance what option would be better for large data sets that are to
Is it good to add line-height in body{line-height:1.5} or it would be better if
Pseudo code: $(document).ajaxError(function(e, xhr, options, error) { xhr.retry() }) Even better would be some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.