I am trying to load any of the igDataChart samples into a WKWebView in an iOS or macOS app.
The HTML portion renders but the jquery portion never does.
Is there a way to load any of the igDataChart samples into a WKWebView in either an iOS or macOS app?
For example this is one that I tried but never got to work:
https://www.igniteui.com/data-chart/binding-json-data
Can anyone advise how to load that HTML page into a WKWebView?
Hi Peter,
I assume you are following the approach that WKWebView requires, since you see the html part rendering. IF you happen to miss something from that, I see plenty of topics on Stackoverflow discussing how to add jQuery components to a WKWebView. like this one.
Do you see any errors coming from the jQuery part of the code ? Any screens or additional information will be helpful. Until that information is available, I can only assume that a possible reason is the needed resources are not loaded in the view, please make sure that you have correctly loaded those.
Hi Hristo An.
I have provided my Xcode project to Michael DiF in the WPF support team, can you contact him to get it?
I don't know how to upload source code to the forum.
I don't see any error in the output when I run on either a device or the iOS simulator using Xcode.
Also, the sample you linked is quite old, UIWebView is no longer used.
Now it is WKWebView (from WebKit) -- this is what my sample project is using.
Let me know if you cannot get the source from Michael DiF and I will try to figure out another way to get it to you.
Sure, I will get the code you have uploaded to our support system One question that I have meanwhile is - Do you mean that getting the https://www.igniteui.com/data-chart/binding-json-data and putting it in your app renders the chart correctly in Safari on macOS, but does not in a iOS app ?
Hi,
I ran the project that you have attached - as you said, HTML is there, but no chart is rendered. Actually, if you load a local html file that just displays an alert on button click, it does not work again. It seems that loading local files is not enough for the local fiels to execute their Javascript code too.
I did some research, and it looks like that you would need to manually inject the Javaxscript codeto be executed in the WKWebView.
Here are some resouces on that:
How to call this javascript function from WKWebView Swift?
iOS WKWebView not showing javascript alert() dialog,
WKWebView advanced tutorial
I ended up copying the externally referenced files to a local directory and then the web page loads, including the javascript.
Michael DiF suggested the idea in a support ticket conversation, so I am just passing it on here.
And as I mentioned to him, loading the page using the native iOS Safari app works.
So Apple is restricting WebView in a user iOS app more than in the native Safari iOS app.
Good to know ! Thank you for sharing the solution in Infragistics forum so that other developers can benefit from it as well !