本文介绍了从inAppBrowser设定值的localStorage没有显示之外 - 科尔多瓦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从inAppBrowser视图设置的localStorage。假设我已经设置了inAppBrowser视图内

I'm setting up localStorage from inAppBrowser view. Suppose inside the inAppBrowser view I've set

localStorage.setItem("page","10");

里面inAppBrowser我要检查,如果该值设置,所以我用

Inside inAppBrowser I want to check if the value is set , so I checked with

alert(localStorage.getItem("page"));

它显示10.现在我关上了inAppBrowser视图,并回到我的主要观点。再然后我给

It's showing 10. Now I closed the inAppBrowser view and back to my main view. Then again I am giving

 alert(localStorage.getItem("page"));

要检查退出事件侦听器的价值。它显示为空或不同以往的价值,但不10.可请你告诉我,什么是错的?????????

to check the value in exit event listener. It's showing null or different past value but not 10. Can you please tell me what's wrong?????????

我也试过用 window.localStorage.setItem(页,10);

基本上,我希望得到来自inAppBrowser视图的值。我试过的setInterval和executeScript 的例子,但在这个例子中的一个问题。当你做内inAppBrowser一些繁重的工作,消耗大量的内存,previous活动/网页就会被杀死或忌用。因而这是效率不高。有没有简单的方法与localStorage的和inAppBrowser或工作得到得到inAppBrowser值主页?

Basically I wanted to get a value from the inAppBrowser view. I tried the setInterval and executeScript example, but there is a problem in that example. When you do some heavy work inside inAppBrowser that consumes lot of memory, previous activity/webpage gets killed or hanged. Thus that is not efficient. Is there any simple way to work with localStorage and inAppBrowser OR to get get a value from inAppBrowser to main page?

推荐答案

因此​​,作为杰里米ĴStarcher&安培;马辛米科瓦伊奇克评价说,这是不可能的。这是因为同一个域策略和inAppBrowser是一个新的实例,不允许previous的WebView访问它。

So as Jeremy J Starcher & Marcin Mikołajczyk commented, it's not possible. It's because of the same domain policy and inAppBrowser is a new instance which doesn't allow the previous webview to access it.

解决方法是在主视图或父的WebView发回所需数据,然后把他们的localStorage。

Solution is to send back the required data in main view or parent webview and then put them in localStorage.

这篇关于从inAppBrowser设定值的localStorage没有显示之外 - 科尔多瓦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 07:12