So this is strange, but if I load a local html file into a WebView using LoadUrl it tries to load all resources using file://
So for example this page loads google web fonts as an external resource.
This only happens on Android iOS works fine.
Has anybody had the same issue?
Note: I'm using the HybridWebViewRenderer if that makes a difference, I also do not have control over the source html files.
Related
Suppose we write a Xamarin MVC application which is deployed to a device and runs connected to the web.
If we need to update the application by downloading some images, CSS, or .js files using WCF service, for example, is that possible?
Does iOS, Android, and Windows allow you to do that?
Thanks
You can not update the app bundle itself on either iOS or Android, and presumably UWP but I am not very familiar with that platform so not sure. For iOS and Android the app bundles are signed so they can not be modified or else the signature will no longer be valid. You can, however, download anything you want and store the downloaded files in the file system. Every app does have a file system it can access to read and write from. See this Xamarin doc:
Forms:
https://developer.xamarin.com/guides/xamarin-forms/working-with/files/
You might also want to look into the PCLStorage plugin:
Xamarin Component: https://components.xamarin.com/view/pclstorage
NuGet: https://www.nuget.org/packages/PCLStorage/
Source: https://github.com/dsplaisted/PCLStorage
(I know I should paste relevant bits from links, but there is just too much to paste and would end up pasting the whole article. If above link is broken, just google "Xamarin working with files")
Note: I work for MS/Xamarin
I have only written PC programs using C#, .NET, and WinForms, and am new to app development.
I have written a program that uses HTML files (as a type of "form"), that will then be passed to an app, which can then be used to read/record data. I.e.
On the PC, a user creates a HTML "form"
This is loaded onto a mobile device (phone or tablet)
The user can then open the app, and access each individual (or individual copies) a HTML form to read/record data.
This is then transferred back to the PC, and stored.
Now, I'm not too concerned with the transfer between the PC/device, or the storage of the data, or any of that at this point. What I am concerned about is the ability to open/view these HTML files within a single app.
As the program has already been written using .NET and WinForms, it needs to be converted to be used on a mobile device, and I have chosen Xamarin for this purpose. However I only have limited knowledge of this package, so I am not sure if I can achieve this within a single app (i.e. without having to pass it to a separate app to view the HTML files).
So: is there an environment in Xamarin that I can use to view HTML files within my app?
Xamarin.Forms has a WebView class that you can use to display HTML content, so viewing the content is rarely an issue.
Interacting with the HTML content can sometimes be a bit tricky because of the links not conforming to what the app expects. But you can often solve these issues using the WebView.Navigating event handler that will allow you to catch and change the navigation behavior.
Xamarin.Forms's WebView relies on the native UIWebView (iOS) and WebView (Android) and Xamarin.Forms allows you to override the native Renderers. Overriding the native renderer will give you access to the native WebView with full flexibility.
You also have the possibility to completely ignore Xamarin.Forms's WebView and write your own view using native views.
It would probably be smart to test your WinForms app on iOS using Safari and on Android using Chrome as they are using the same rendering engines that will be used in respectively UIWebView (iOS) and WebView (Android)
I'm making an app using the Intel XDK.
I'm also using the "app preview" app on a Galaxy Tab 2.
My problem is that when I "push" files to the Intel servers to load onto my device, there seems to be either a delay, or a caching issue because I'm getting what I KNOW is old js and css code.
The HTML file seems to change just fine.
As a work-around, I was loading my js file with a unique number in the src, like this:
<script type="application/javascript" src="js/ae.js?ver=abc123"></script>
but now even that only works sometimes.
Am I doing something wrong?
I've seen this happen sporadically. The webview should clear out the files. Have you tried using the Debug tab and testing through App Preview? It will load Crosswalk then for you. This lets you connect your device through USB and debug in a much faster way.
I am using the Joomla Jumi module to call an external file script that loads via php a few images.
This in all desktop browsers, but on mobile safari the images are completely removed from the DOM.
I have tested just using the Jumi module to place an image with the "Code written" section of the module and it is removed as well.
Upon further testing I think I have narrowed down the issue. For some reason it is only doing this on jailbroken devices.
Not sure why this is happening, but on any of my devices that are jailbroken the image gets removed, but on non-jailbroken it works just like the desktop browsers.
This one is strange
When I run the flash player (from flashdevelop) the images are loaded and everything is fine.
But when I run the swf from a browser the requests are sent (using chrome's tools for programers - network tab) but nothing is loaded. The size/content column shows 0/actual size of the file
This makes me sad.
Any ideas where to look for an answer?
Make sure that you either compile the swf with the bitmaps imported in your stage/library or make sure that the html version has the right directory setup when the bitmaps are loaded from other directories