Storing the Window Object in local storage

久未见 提交于 2019-12-02 07:19:01

问题


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));

回答1:


You 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.



来源:https://stackoverflow.com/questions/30463833/storing-the-window-object-in-local-storage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!