Open johnpaulmanoza opened 7 years ago
I was having the same issue. Seems to be an issue with Android and ES6 syntax that is specific to the WebView-Bridge extension. It worked once I changed reverted my code to ES5. Hope this quick fix works for you too! Stay awesome!
@johnpaulmanoza have you fixed this? I am having the same issue.
@MatthewAwesome your answer doesn't help at all. If you are not going to investigate specific cases, don't waste time posting generic answers.
My solution to make it work:
I am injecting some JS code to read cookies in WebViewBridge , and the injected code wasn't running. The issue was that Android doesn't allow commented code or 'spaces'.
So I removed unnecessary code from my injectedJS and started to work.
_injectScript = `function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
var transactionToken;
(function () {
if (WebViewBridge){
WebViewBridge.onMessage = function () {
WebViewBridge.send(document.cookie);
};
}
}());`;
@facuescobar I have the same problem,I use sendToBridge method send JSON string,I use JSON.parse to parse the JSON string in html,but it not working. how can i resolve this problem?
This code works fine in iOS but not in Android 6.0 Device.