我已经开发了使用Facebook C# SDK,使用OAUTH和Web浏览器控件的WP7客户端。
一切正常,除了在要求用户接受/拒绝我要求的访问权限的页面上,“不允许”和“允许”按钮不在浏览器屏幕的底部,而实际上是“很明显,用户必须向下滚动才能单击它们。
我尝试使用所有不同的display modes(触摸,wap,页面,弹出窗口),而“页面”是唯一在同一页面上显示按钮的字体,但是字体很小。我还尝试过使用其他大小的浏览器控件。
SDK中的示例具有相同的行为。
有没有人找到解决方法?
最佳答案
我发现的解决方案是使用Javascript更改元素的CSS属性:
private void FacebookLoginBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
// check for when this approve page has been navigated to
if (FacebookLoginBrowser.Source.AbsolutePath == "/connect/uiserver.php")
{
showBrowser();
// do the script injection on the LoadCompleted event - doing it here will appear to work when you have a fast connection, but almost certainly fails over 3G because the elements aren't ready in time to be modified
FacebookLoginBrowser.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(FacebookLoginBrowser_LoadCompleted);
}
// etc ...
}
void FacebookLoginBrowser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
FacebookLoginBrowser.LoadCompleted -= FacebookLoginBrowser_LoadCompleted;
// Facebook will likely change this and break our code soon, so make sure you anticipates this
try
{
FacebookLoginBrowser.InvokeScript("eval", "document.getElementById('platform_dialog_bottom_bar').style.position = 'relative';document.getElementById('platform_dialog_bottom_bar').style.top = '-60px';");
}
catch
{
// TODO: display instruction to scroll down if we ever end up here
}
}
希望对您有所帮助。遇到问题请随时与我联系
关于windows-phone-7 - WP7 Facebook OAUTH浏览器控件上的“Don't允许”和“Allow”按钮始终在屏幕外,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6272366/