Skip to content
This repository was archived by the owner on Dec 5, 2023. It is now read-only.

Android Fix for WebView 47+#2

Open
WBasti wants to merge 6 commits intoCoherentLabs:masterfrom
WBasti:master
Open

Android Fix for WebView 47+#2
WBasti wants to merge 6 commits intoCoherentLabs:masterfrom
WBasti:master

Conversation

@WBasti
Copy link

@WBasti WBasti commented Feb 16, 2016

It seems like the communication between javascript and WebView via iframe is no longer reliable on Android devices running WebView Version 47+. Therefore I created a direct communication between javascript and WebView using the JavaScriptInterface. To keep the compatibility with iOS, I added a check in coherent.js if the __couiAndroid-Interface is defined. If not, the script uses an iframe for communication (like it did before).

My changes are related to this thread in the forum:
https://forums.coherent-labs.com/index.php/topic,1061.0.html

frame.height = '1px';
document.documentElement.appendChild(frame);
frame.parentNode.removeChild(frame);
if(window.__couiAndroid == undefined) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use space after keywords.

@dimitarcl
Copy link
Member

Thanks for adding support for the newer Android WebView.
I have pointed a couple of places in JavaScript, where you have used different that ours formatting style.
I am curious did you run some performance benchmarks on this changes? I would expect the new way to be faster, but one never knows :)

@WBasti
Copy link
Author

WBasti commented Apr 27, 2016

I fixed the code formatting. Hope it's ok now. Sorry it took so long, but I had a lot of work and forgot about this pull request...
Unfortunately I did not have the time to run benchmarks on those changes, but I also guess that the direct calls run a lot faster than the workaround using an iframe.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants