The general range of variables between two browser tabs?

I have a web application with an HTML form that contains a select / option entry. It worked great in a demo with 200 items, even if it's clumsy to find the one you want, but there are actually more than 30,000 items. (This is a list of parts.)

My first thought is that instead of the “pop-up window” there is a “select part” button, and a second browser tab opens (“Search for parts”), and then a complete list is displayed, search options, etc., each with a “ copy to clipboard. " Then the user can click one and return to the original form and click the "paste" button, and the name of the part will be entered into the form.

I ask if there is a javascript area in which I can store a small text box and an identifier number on the Parts Search tab so that I can get it when the user clicks the paste button on the main page of the form? I do not want to send messages to the server.

(BTW I'm not necessarily interested in using Ctrl + C / V or using the system clipboard, if only this part of a simple solution.)

Thanks!

+4
source share
2 answers

You can use HTML5 storage API - window.localStorage

 var val = localStorage.getItem("key"); //get localStorage.setItem("key", val); //set 

Much cleaner than cookies. More details here .

+4
source

While the first page opens the Search Parts tab, you must have access (from inside the Search Parts page) to the window.opener object. If you have a global object installed on the parent page that contains the properties / variables you need, you must have full access from the child page. Since the first page opens this opening, you will still have access to the calling methods in the child, but I would personally stick to ensure that one or the other performs the update.

+2
source

All Articles