none
WebBrowser & IE 11 - How do I turn OFF (Are you sure you want to leave this page) RRS feed

  • Question

  • Hi, wanna turn (Are you sure you want to leave this place) OFF that pops up when I submit a Form in a web-site.

    If it can be done programatically cause I'm gonna share my App and I don't wanna bother my users to tell them to go to their IE settings to OFF it.

    I read here and they said I have to use "window.onbeforeunload = null" but the issue is I don't know how to use it in VB .net


    • Edited by LetMeCode Friday, September 30, 2016 12:34 PM
    Friday, September 30, 2016 12:30 PM

Answers

All replies

  • If you are writing code for a web page then you need to post to one of the ASP.NET forums.

    http://forums.asp.net/

    Otherwise, this is likely an IE setting that would need to be modified.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, September 30, 2016 1:01 PM
  • Well without setting I.E. specifically, you will have to search for how to do that, then possibly C# code from this project Suppressing Hosted WebBrowser Control Dialogs you may be able to download (if you join CodeProject) and then use an online converter like Telerik to convert the code from C# to VB.Net if it will convert correctly for use with a WebBrowser Control.

    La vida loca

    Friday, September 30, 2016 1:09 PM
  • Thanks Paul.

    But ASP forum is fully about Web Programming whereas I don't know Web Programming.

    Friday, September 30, 2016 1:29 PM
  • Thanks Paul.

    But ASP forum is fully about Web Programming whereas I don't know Web Programming.


    That was JavaScript code you posted so I needed to check.

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, September 30, 2016 3:48 PM
  • I didn't know it was a JavaScript code.
    Friday, September 30, 2016 3:55 PM
  • Look at this page.

    This prompts

    <!DOCTYPE html>
    <html>
    <body onbeforeunload="return myFunction()">
    
    <p>Close this window, press F5 or click on the link below to invoke the onbeforeunload event.</p>
    
    <a href="http://www.w3schools.com">Click here to go to w3schools.com</a>
          
    <script>
    function myFunction() {
        return "Write something clever here...";
    }
    </script>
    
    </body>
    </html>
    

    This does not

    <!DOCTYPE html>
    <html>
    <body>
    
    <p>Close this window, press F5 or click on the link below to invoke the onbeforeunload event.</p>
    
    <a href="http://www.w3schools.com">Click here to go to w3schools.com</a>
          
    <script>
    function myFunction() {
        return "Write something clever here...";
    }
    </script>
    
    </body>
    </html>
    


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, September 30, 2016 4:01 PM
    Moderator
  • @Karen Payne.

    Thanks for your reply but I still don't understand what should I do with the above link and the two code snippets.

    Seems like it's a Javascript code and I don't know how to integrate Javascript in VB.Net.

    Please can you be more explicit?

    Saturday, October 1, 2016 8:44 AM
  • @Karen Payne.

    Thanks for your reply but I still don't understand what should I do with the above link and the two code snippets.

    Seems like it's a Javascript code and I don't know how to integrate Javascript in VB.Net.

    Please can you be more explicit?

    You don't integrate the code into VB.NET as what I presented is an event that a developer can subscribe too.

    Think of it this way, when you place a button on a form, double click, an event is created and you write code. In Javascript a developer writes code rather than double click to create an event so that they can watch for that particular event. The proper method to remove an event is via jQuery which you don't have access to from your vb.net desktop program.

    The event is there for a reason and if this was your code you would then have a method to turn off the event but that is not the case here.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Saturday, October 1, 2016 8:59 AM
    Moderator
  • Hi everybody.

    Problem solved. Check the solution here.

    ...really appreciated your help.

    Saturday, October 1, 2016 10:07 AM
  • Hi Freesix007,

    Glad to see you find a solution. Please remember to close this thread by marking useful posts as answer. And if you have something else regarding this issue, please feel free to contact us.

    Thank you for participating in the activities and sharing your issues.

    Best Regards,

    Neda Zhang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, October 6, 2016 8:19 AM
    Moderator