Search Unity

WebView on Windows Store and Windows Phone

Discussion in 'Windows' started by kit, Jul 31, 2014.

  1. kit

    kit

    Joined:
    Jun 16, 2011
    Posts:
    87
    Hi

    Please tell me how to embed the WebView with special address to Unity3d application for Windows Store and Windows Phone

    Thanks
     
  2. Temujiing

    Temujiing

    Joined:
    Jul 14, 2014
    Posts:
    19
  3. kit

    kit

    Joined:
    Jun 16, 2011
    Posts:
    87
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    What exactly your issue is?
    In order to use WebView you most certainly need XAML. Which version of Unity do you use? We've dropped D3D support since 4.5.
    You certainly can mix Unity and XAML. There are certain rules and limitations, but in general it works fine.
     
  5. kit

    kit

    Joined:
    Jun 16, 2011
    Posts:
    87
    Hi!

    At first, thank you a lot for your feedback

    >>>What exactly your issue is?
    I just want to show web content (html page) on the Windows Store Unity3d application and Windows Phone device


    >>>Which version of Unity do you use?
    4.3.2.

    >>>You certainly can mix Unity and XAML. There are certain rules and limitations, but in general it works fine.

    Thanks, I still trying to implement this. I'll post here when I finish with this task :)
     
  6. kit

    kit

    Joined:
    Jun 16, 2011
    Posts:
    87
    So, even now I cannot find a way to create WebView over the Unity3d screen. Is there any solution ?
     
  7. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    What exactly are you doing? Have you tried putting various XAML controls on your page? Are they visible?
     
  8. kit

    kit

    Joined:
    Jun 16, 2011
    Posts:
    87
    >>>What exactly are you doing?
    Try to create WebView without xaml files.

    >>>Have you tried putting various XAML controls on your page? Are they visible?
    I want to add WebView control on pages by next step:
    - Create plugin for Windows Phone. In this plugin I want to create WebView, not using xaml. Pass to this WebView url. Handle all events from WebView in this plugin.


    So, for now, I cannot find the code for creating WebView without xaml files
     
  9. source_transformer

    source_transformer

    Joined:
    Aug 20, 2014
    Posts:
    1
    I got this working without creating xaml files - but I don't think I'm allowed to post code I wrote at work.

    The basic gist of my approach was to programmatically instantiate a
    Windows.UI.Xaml.Controls.Primitives.Popup and add a
    Windows.UI.Xaml.Controls.WebView control to it. Then use the WebView.Navigate(..) method to get the WebView to render an arbitrary web page.

    The only thing I found a little surprising was that I did end up having to explicitly specify the height and width of the WebView using the WebView.Height and WebView.Width properties (the PopUp should inherit/use the sizes of its contained control/child).
     
  10. hrjunker

    hrjunker

    Joined:
    Nov 15, 2011
    Posts:
    26
    Hi

    I am also trying to acheive this, did you solve it yet @kit ?

    @source_transformer could you maybe share a bit more information about it, like how do you instatiate the Popup and add the webview to it? Is it done in a seperate thread?
     
  11. source-transformer

    source-transformer

    Joined:
    Jul 4, 2014
    Posts:
    4
    Have you tried this and are getting errors/exceptions?

    Just use the classes I cited above for WS 8.1 (there are equivalent ones for WP 8.0 - WebBrowser for example) and you can either use the Unity method for getting onto the UI thread (http://docs.unity3d.com/Manual/windowsstore-appcallbacks.html or UnityEngine.WSA.Application.TryInvokeOnUIThread(..)) or use the Windows Store way (Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher) or the Windows Phone way (System.Windows.Deployment.Current).

    I'd recommend posting the issues you're having with getting this working - perhaps with a code snippet.
     
  12. kit

    kit

    Joined:
    Jun 16, 2011
    Posts:
    87
    Hi @hrlarsen ,

    Nope, we implemented his window by adding custom unity3d UI. And processed all events like in html page. So this is not a solution at all :)
     
  13. icodes-studio

    icodes-studio

    Joined:
    Aug 7, 2017
    Posts:
    1