locked
How to know that url from webview get clicked? RRS feed

  • Question

  • Hello all

    i am working on windwos store app in C#/XAML

    when i clicked on url which is inside one of the webview it is navigated inside the webview.

    now how can i open this url in any browser from my app.

    how can i do that??


    Regards, Kartik Ghodasara Associative Software engineer, Synoverge Tech Pvt. Ltd. Ahmedabad Please vote or mark as answer if it helps...

    Friday, October 26, 2012 12:34 PM

Answers

  • You'll have to follow these steps:

    1) Inject javascript into the page to intercept clicks inside the webpage

    2) Send the URL of the click to your C# app using window.external.notify(string)

    3) Open the URL with the default protocol handler

    I posted on how to do steps 1 and 2 here: http://blogs.msdn.com/b/wsdevsol/archive/2012/10/18/nine-things-you-need-to-know-about-webview.aspx#AN5


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Proposed as answer by saramgsilva Friday, October 26, 2012 1:14 PM
    • Marked as answer by Jesse Jiang Thursday, November 1, 2012 3:01 AM
    Friday, October 26, 2012 1:06 PM
    Moderator

All replies

  • You'll have to follow these steps:

    1) Inject javascript into the page to intercept clicks inside the webpage

    2) Send the URL of the click to your C# app using window.external.notify(string)

    3) Open the URL with the default protocol handler

    I posted on how to do steps 1 and 2 here: http://blogs.msdn.com/b/wsdevsol/archive/2012/10/18/nine-things-you-need-to-know-about-webview.aspx#AN5


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Proposed as answer by saramgsilva Friday, October 26, 2012 1:14 PM
    • Marked as answer by Jesse Jiang Thursday, November 1, 2012 3:01 AM
    Friday, October 26, 2012 1:06 PM
    Moderator
  • thanks Matt

    'll let u know if i get in any problem following steps.


    Regards, Kartik Ghodasara Associative Software engineer, Synoverge Tech Pvt. Ltd. Ahmedabad Please vote or mark as answer if it helps...

    Friday, October 26, 2012 1:32 PM