The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
invokeScript calls itself twice RRS feed

  • Question

  • Hello Community,

    I'm using invokeScript to communicate with my JavaScript Core. But invokeScript always calls twice it's function, on the Emulator and the developer device. I heard this is a bug. Does anyone know if thats happens on a real device and if there is a Workaround?

    Thanks

    Tuesday, January 29, 2013 10:29 AM

Answers

  • ok, as usual, it's my fault *ashame*

    I set in the xaml

    ScriptNotify="HTML_Script_Launched"


    and again in my C# file:

    Browser.ScriptNotify += HTML_Script_Launched;

    therefore only the JavaScriptResponse is called twice.

    However, thank your very much for helping!

    Friday, February 1, 2013 12:45 PM

All replies

  • I'm not aware of any bug like that for Windows Phone and I do not see that behavior in a test application.

    Can you give an example of some code that reproduces the problem?


    -Eric.

    Wednesday, January 30, 2013 9:45 PM
  • Hi Eric,

    the C# code:

    Browser.InvokeScript("launchNotify");

    JavaScript:

    launchNotify = function () {
        window.external.notify("Test");
    }

    I only use this simple code and and it's always called twice.

    Thursday, January 31, 2013 9:00 AM
  • I'm still not seeing the problem... there must be more to it than that.

    Which OS version is your project targeting? 

    Are you using NavigateToString or simply Navigate?

    If using Navigate are you loading the content from a local or network source? 


    -Eric.

    Thursday, January 31, 2013 4:54 PM
  • It's a WP8 Project.

    I don't use Navigate or NavigateToString. Only the code above with a simple Browser in the XAML.

    The JavascriptCode is a local folder. But it's not the code, because I created a new demo JavaScript file only with the function above.

    Thanks for trying to help. I can't imaging that I'm the only one with this Problem. 

    Friday, February 1, 2013 8:51 AM
  • ok, as usual, it's my fault *ashame*

    I set in the xaml

    ScriptNotify="HTML_Script_Launched"


    and again in my C# file:

    Browser.ScriptNotify += HTML_Script_Launched;

    therefore only the JavaScriptResponse is called twice.

    However, thank your very much for helping!

    Friday, February 1, 2013 12:45 PM