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
Use of confirm() function fails RRS feed

  • General discussion

  • Hi,

    I am working on my first phone app and I have a JavaScript question...
    When I use the following code the "confirm" line I do not get the question on the screen, it just blows on by and gives me a "false" response.

    All the examples I have found for the "configm" function always have the confirm line under a button NOT burried in existing code.

    ANyone got any suggestions?

     

     

    if (Licensing == "false") {

     

        console.log(

     

    "Entered FALSE mode");

     

     

     

        if (confirm("To continue to use Anchor Watch you must accept the GPS Licensing. Do you accept?")) {

     

            alert(

     

    "You accepted.");

     

            setLocalStorage(

     

    "Licensing", true);

     

        }

     

     

        else {

     

            alert(

     

    "You declined.");

     

            setLocalStorage(

     

    "Licensing", false);

     

            window.close();

        }

        console.log(

     

    "answer - " + answer);

     

    }

    Thanks
    Phill

    Monday, June 11, 2012 5:29 PM

All replies

  • Are you testing this in the full browser or in an application using the WebBrowser control?

    The WebBrowser control in Windows Phone SDK does not support creating new windows so calls to alert, confirm, and prompt will not work as expected when running in the context of the WebBrowser control.
     
    One alternative you could use is a Frame, or other element, with the disclaimer and a checkbox indicating acceptance.
    Monday, June 11, 2012 9:02 PM
  • Hi Eric,

    Thanks for the response...

    I am usaing the Windows Phone emulator to show/display the app.  The alert function seems to work exactly as expected but confirm does not...

    In my code I have a settings page which does have a check box for the user to accept or decline the licensing. 

    At this particlar point in the code the app has just been loaded and the code is checking to see if the user accepted or declined the license before.  It then asks the user if they would like to "Accept" the license now (Ok, Cancel).  What is the accepted standard for this type of situation?  IF the user has declined the License then nothing should happen/work, except the Settings page.

    Thanks
    Phill
    Monday, June 11, 2012 9:56 PM
  • Hi Mark,

    Thanks for the response.

    If I understand the example you pointed to it uses the ScriptNotify().   Which is a Windows C# funciton and I am trying to keep this app neutral by using ONLY JavaScript and HTML5 coding.

    Thanks
    Phill
    Monday, June 11, 2012 9:59 PM