I need the ability to persist the window object. I tried to stringify the window object but I received and error when trying to convert the window object to JSON. "Converting circular structure to JSON" error. Is there anyway I can store the window object from a window.open in local store?
var myWindow = window.open("file:///D:/Temp/teststorage.html", "MsgWindow", "width=200, height=100");
localStorage.setItem('Window', JSON.stringify(myWindow));
I need the ability to persist the window object. I tried to stringify the window object but I received and error when trying to convert the window object to JSON. "Converting circular structure to JSON" error. Is there anyway I can store the window object from a window.open in local store?
var myWindow = window.open("file:///D:/Temp/teststorage.html", "MsgWindow", "width=200, height=100");
localStorage.setItem('Window', JSON.stringify(myWindow));
Share
Improve this question
edited May 22, 2017 at 9:45
mplungjan
179k28 gold badges182 silver badges240 bronze badges
asked May 26, 2015 at 16:15
VictorVictor
6661 gold badge5 silver badges17 bronze badges
1
- Possible duplicate of can I save a window object inside a localStorage – Herohtar Commented Jul 30, 2019 at 4:15
1 Answer
Reset to default 4You can't persist a window
object in local storage.
You can only store data in the form of strings in local storage, and there is no way to turn the window
object into a string so that you can recreate the same window
object.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745176116a4615201.html
评论列表(0条)