SKLn-Rad / Xam.Plugin.Webview

Xamarin Plugin for a HybridWebView in PCL projects.
Other
141 stars 61 forks source link

LocalStorage not available to sites on Android #19

Open jonathankretzmer opened 7 years ago

jonathankretzmer commented 7 years ago

Hi,

I'm struggling to load a site into the Webview when running on Android. After some research it would appear that the following setting needs to be set for it to work: https://developer.xamarin.com/api/property/Android.Webkit.WebSettings.DomStorageEnabled/

I also see that the latest on Nuget is 1.4.2 (22 April) but the latest reference here is 1.4.0.

Thanks for the great work! J

SKLn-Rad commented 7 years ago

Hey man, thanks for pointing out the source is out of date, normally I merge stuff over from my own personal SVN and have been neglecting to do so recently 👎

In regards to your problem, you can update your settings manually by hooking into FormsWebViewRenderer.OnControlChanging and then casting the control to an Android.WebKit.WebView.

Alternatively, you can just use 1.4.3 which I just published which now includes the DomStorageEnabled flag as default!

Letme know if this fixes it for you so I can close this ticket :)

~ Ry

jonathankretzmer commented 7 years ago

Hey Ryan,

Thanks for the speedy response.

That fix did the trick in alleviating the error message I was getting when attempting to use localstorage, thanks!

I am, however, now experiencing a different issue where the content doesn't seem to be displaying (though of course not due to the previous issue). I'll need to go through and see whether I can find any other reason why this is happening.

Thanks for the tip on the OnControlChanging event, I'll be sure to use that to do any further config changes as I need!

Regards, Jonathan.

On 26 April 2017 at 14:56, Ryan Dixon notifications@github.com wrote:

Hey man, thanks for pointing out the source is out of date, normally I merge stuff over from my own personal SVN and have been neglecting to do so recently 👎

In regards to your problem, you can update your settings manually by hooking into FormsWebViewRenderer.OnControlChanging and then casting the control to an Android.WebKit.WebView.

Alternatively, you can just use 1.4.3 which I just published which now includes the DomStorageEnabled flag as default!

Letme know if this fixes it for you so I can close this ticket :)

~ Ry

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SKLn-Rad/Xam.Plugin.Webview/issues/19#issuecomment-297398266, or mute the thread https://github.com/notifications/unsubscribe-auth/AE37SgyA_uDlN_SABnUlpRGBAo3LxJwVks5rzz7sgaJpZM4NIuj1 .

SKLn-Rad commented 7 years ago

Thats odd, it passed all the unit tests fine! Letme know if you can figure it out and if possible throw me a sample app and I will try to get back to you as soon as possible. Most of my testing is using local files so I may have missed something with Internet and String based HTML data.

~ Ryan

Edit: Worst case for now, just use 1.4.2 and use the OnControlChanged trick 👍

jonathankretzmer commented 7 years ago

Hi Ryan.

Apologies, I think I have you an incorrect impression. I believe the complexity and problem stems more from the particular site I'm trying to host within the WebView than the WebView itself.

I believe you've solved that previous issue, I just need to figure out what may be causing nothing to display for the page now on Android by going through the logs.

For interest sake, the site I'm trying to load is: HTTPS://tablet.mymps.co.za/v3/mps-ui/

Works perfectly for UWP and Win81, not Android, iOS untested.

J

On 26 Apr 2017 3:20 p.m., "Ryan Dixon" notifications@github.com wrote:

Thats odd, it passed all the unit tests fine! Letme know if you can figure it out and if possible throw me a sample app and I will try to get back to you as soon as possible. Most of my testing is using local files so I may have missed something with Internet and String based HTML data.

~ Ryan

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SKLn-Rad/Xam.Plugin.Webview/issues/19#issuecomment-297405442, or mute the thread https://github.com/notifications/unsubscribe-auth/AE37Sqwi_R4WDgZBL4Cf3WDtyzSx4Hsyks5rz0SugaJpZM4NIuj1 .