Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8972917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:19:58+00:00 2026-06-15T18:19:58+00:00

I am injecting this JS to get the navigating url ( destination ) at

  • 0

I am injecting this JS to get the navigating url (destination) at run time. I am getting JS exceptions. What is wrong?

     static String NAVIGATING_FUNCTION = "window.onbeforeunload = function(){ window.external.notify(' + location.href + ''); };";
     webView.InvokeScript("eval", new String[] { NAVIGATING_FUNCTION });

Also please tell me how to cancel the navigation and return back to the previous page using this JS?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:19:59+00:00Added an answer on June 15, 2026 at 6:19 pm

    If I understand correctly, since I haven’t used the WebView (yet), you want to report the current location before leaving and then cancel it?

    You could try this:

    window.onbeforeunload = function(){ window.external.notify(location.href); return false; };
    

    I am not sure why you had quotes in there; location.href would be in that web view, and it would be passed as a string.

    Also, take a look at the responses to this thread. One of them says:

    Did you get your problem solved? In the Release Preview, you need to
    add some code that looks like this:

            List<Uri> allowedUris = new List<Uri>();
            allowedUris.Add(e.Uri);
            allowedUris.Add(new Uri("http://www.bing.com"));
            Browser.AllowedScriptNotifyUris = allowedUris;
    

    Another thing, this thread: Can I get the current HTML or Uri for the Metro WebView control?, talks about the LoadCompleted event handler.

    See if that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Throughout this day I've been investing time into fingerprint matching/recognition algorithms/implementations in the world
Keep getting this error after inserting a subdatasheet into a query and trying to
I've tried to get this to work on several operating systems (Windows 7, OS
I've been trying to get wicket and guice working together, more specifically injecting a
I have a similar question like XML indenting when injecting an XML string into
I hope that in this post, I can get people's opinions on best practices
From the registry, for a given file type, I get a string containing something
I've been injecting this jQuery code from the code behind of a .net user
There was 2 questions here saying injecting the whole service container should solve this.
I'm trying to instantiate a SecondViewModel from a MainViewModel injecting in this second one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.