Answered by:
Button renderd in WebView Control of windows 8 metro apps does not fire(using Xaml with C#).

Question
-
Hi,
We have an input to the web view control as shown below
<!DOCTYPE HTML>
<html>
<head></head>
<body>
<script data-app-id="hyB2pTvrL36Y50py8EWj6A"
src="https://assets.yammer.com/platform/yam.js"> </script>
<script> yam.connect.embedFeed({
container: "#embedded-feed",
network: "microsoft.com",
feedType: "group",
feedId: "2263302"});
</script>
<div id="embedded-feed"></div>
</body>
</html>The above code renders fine in Web view control displaying a login button. But when I do click on the button, the event does not fire. But the same code saved as html file opens fine in Internet Explorer and Click event fires up successfully, opening a new window to login.
we do try out adding ScriptyNotify and InvokeScript events. But they did not help us out.
Below are the snippets of code which were added.
WebView_Content.ScriptNotify += WebView_Content_ScriptNotify;
WebView_Content.AllowedScriptNotifyUris = WebView.AnyScriptNotifyUri;and below is how we input for WebView control
WebView_Content.NavigateToString(Head + "<body style='font-family:Segoe UI !important;' bgColor=\"" + bgColor.Color.ToString().Remove(1, 2) + "\">" + selectItem.tileActionURL + "</body>");
Thanks in advance
Friday, August 16, 2013 11:23 AM
Answers
-
I got a little further and saw that the error was due to WebView not able to open a pop-up window for authentication. For authentication purposes, I would recommend using WebAuthentictionBroker which supports a callback URI and OAuth. You can check out the MSDN link and also some other Yammer forums over the web for this.
-Sagar
- Marked as answer by Anne Jing Tuesday, August 27, 2013 2:48 AM
Monday, August 19, 2013 2:17 PM
All replies
-
Hi Aparna,
I will try to replicate the issue using above code but if you have a sample that I can look at, you can share it via SkyDrive.
-Sagar
Friday, August 16, 2013 2:59 PM -
Hello Sagar,
Thanks for your quick reply.
Below is the skydrive path which has sample code to repro the issue.
https://skydrive.live.com/?cid=2034c3f658db051a&id=2034C3F658DB051A%21123&Bsrc=Share&Bpub=SDX.SkyDrive&authkey=!Ate__xm5nCMve3E
After launching the shared app you will get link as "Click here to view WebView", upon clicking webview will be displayed with Yammer login. On clicking login button no action is taking place.
Thanks,
Aparna
Monday, August 19, 2013 11:59 AM -
Hi Aparna,
I get an ACCESS DENIED error as soon as I click the Yammer log-in button. I think what you can do is, right click the project in Visual Studio Solution Explorer and then go the "DEBUG" horizontal tab and in "Debugger type" select "Script" . With this, run your project and you should be able to see the actual error message that could be avoiding the button click handler to be invoked.
-Sagar
Monday, August 19, 2013 1:22 PM -
I got a little further and saw that the error was due to WebView not able to open a pop-up window for authentication. For authentication purposes, I would recommend using WebAuthentictionBroker which supports a callback URI and OAuth. You can check out the MSDN link and also some other Yammer forums over the web for this.
-Sagar
- Marked as answer by Anne Jing Tuesday, August 27, 2013 2:48 AM
Monday, August 19, 2013 2:17 PM -
Sagar,
Are you able to see the message in UI or while Debugging. As we could not see any such on UI.
To use WebAuthNBroker(WAB) it is a different story in our case. As the source could be dynamic from user input.
Thanks for your prompt response and guidance.
-Krishna Tejaswi
Thanks & Regards Tejaswi Chandrapatla
Monday, August 19, 2013 3:51 PM -
I saw it while debugging. You need to enable "Script Debugging" for the Windows Store application in which the XAML hosts the WebView. When you click log-in, into the WebView, it tries to initiate the authentication using OAUTH - for which WAB is the best option.
-Sagar
Tuesday, August 20, 2013 3:54 PM