Webview Url binding

Hi !

I’d like to know why my app crashes (screen totally white on device, no error in console) if I replace Url property as follows, binding to an observable. Is Webview supporting only static URLs?

Thanks Max

Url="{producturl}"

  <Page ux:Name="b2">
                      <Panel>
                        <NativeViewHost>
                            <WebView Dock="Fill" Url="http://www.google.com&quot;                                     ux:Name="web"/>
                        </NativeViewHost>
                    </Panel>
 </Page>

Hi!

You might get that issue if you supply the WebView with an empty url at first (i think this issue will be fixed very soon). What does your JavaScript look like?

I was suspecting that, so the observable is given the Url first thing at app startup…first lines of JS code. But it doesn’t work as well.

Max

Would you be able to post some of you code?

Of course. I tested again, it works with static url but not in this way. Am I doing something wrong ?

<JavaScript>
  var Observable = require("FuseJS/Observable"); 

  var producturl = Observable("http://www.google.com&quot;);

  module.exports={producturl:producturl}

  ....
</JavaScript>

  UX:

  <Page ux:Name="b2">
            <Panel>
            <NativeViewHost>
              <WebView Dock="Fill" Url="{producturl}" ux:Name="web"/>
            </NativeViewHost>
          </Panel>
 </Page>

 ...

Your code is working for me. I put it together like this:

<App Theme="Basic">
    <Panel>
        <JavaScript>
            var Observable = require("FuseJS/Observable");

            var producturl = Observable("http://www.google.com");

            module.exports = { producturl:producturl }
        </JavaScript>
        <Page ux:Name="b2">
            <Panel>
                <NativeViewHost>
                    <WebView Dock="Fill" Url="{producturl}" ux:Name="web"/>
                </NativeViewHost>
            </Panel>
        </Page>
    </Panel>
</App>

Are you using the newest version of Fuse?

Yes, I’m using last version 0.9.7

I can’t understand, my project has grown, 700+ lines JS, I’ve only abstracted a bunch of lines to explain the problem. I have 3 panels, each containing 3/4 pages swiping horizontally, several observables, sqlite module. So I guess something else is interfering and causing this, but is hard to debug.

I’ll keep on testing.

Thanks for now

Max

You are right, Kristian. I 've re-done the layout from scratch and it works also with Observable Urls. Don’t know what happened but surely was my error.

Thanks

Max

That’s good to hear Max!

I’ll flag this post as resolved then :slight_smile: