PhoneGap的/科尔多瓦ChildBrowser将不会运行的Twitter网页意图(SSL?) [英] Phonegap / Cordova ChildBrowser won't run Twitter web intents (SSL?)

查看:267
本文介绍了PhoneGap的/科尔多瓦ChildBrowser将不会运行的Twitter网页意图(SSL?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想微博分享功能整合到我的Andr​​oid的PhoneGap的应用程序,而不是重新实现缩短的URL和跟踪鸣叫长度的控制,我想我会在<$使用他们的premade网络意图C $ C> HTTPS://twitter.com/intent / ...

I'm trying to integrate Twitter sharing functionality into my Android PhoneGap application, and rather than re-implement the controls to shorten URLs and track tweet length, I thought I'd use their premade web intents at https://twitter.com/intent/...

所以我想在ChildBrowser窗口中启动像 https://twitter.com/intent/tweet?text=Hello 一个URL,这样我就可以让Twitter的界面接管。用户可以用自己的凭据登录,而一旦他们已登录,从网址参数文本将出现在鸣叫框。

So I'm trying to launch a URL like https://twitter.com/intent/tweet?text=Hello in a ChildBrowser window, so that I can let Twitter's interface take over. The user could sign in with their credentials, and once they're signed in, the text from the URL params would appear in the Tweet box.

这是行不通的。当我使用 HTTP://twitter.com/intent / ... 而不是 HTTPS://twitter.com/intent / ... ,ChildBrowser显示登录屏幕,但只要用户提交他们的凭证,屏幕变白。我怀疑这是因为Twitter切换到HTTPS。

It won't work. When I use http://twitter.com/intent/... instead of https://twitter.com/intent/... , ChildBrowser displays the sign-in screen, but as soon as the user submits their credentials, the screen goes white. I suspect this is because Twitter switches over to HTTPS.

我证实,这是由尝试简单的情况下 window.open 而不是 window.plugins.childBrowser.showWebPage 。我在Android上使用本机浏览器时,有HTTP / HTTPS没有问题。不过,原生浏览器会提示我接受未验证的安全证书。我怀疑这是用ChildBrowser问题 - 它不知道如何处理提示。

I confirmed that this was the case by trying a simple window.open instead of window.plugins.childBrowser.showWebPage. I have no problems with HTTP / HTTPS when using the native browser on Android. However, the native browser prompts me to accept an unverified security certificate. I suspect this is the problem with ChildBrowser - it doesn't know how to handle that prompt.

使用浏览器原生酥料饼根本不是一个选项:用户需要能够打'分享Tweet'或'请'等后退出的过程中,但Android设备简单动作上的返回按钮历史退一步,为他们的意图POST操作。然后,重新启动,而不是返回到初始状态,从头开始应用。

Using the native browser popover simply isn't an option: the user needs to be able to exit the process after hitting 'Tweet' or 'Follow', etc., but the 'back' button on the Android device simply moves the history one step backward to the POST action for their intent. Then, it re-launches the app from scratch, instead of returning you to the original state.

如何配置ChildBrowser /我的Andr​​oid应用程序的PhoneGap覆盖在Twitter上SSL的问题,这样我就可以在Childbrowser运行网络意图?

相关code是:

base="https://twitter.com/intent/tweet?text="; 
URL=base+encodeURIComponent("it works!"); 

// works, but asks to accept a certificate
window.open(URL);

// blank white page
window.plugins.childBrowser.showWebPage(URL, { showLocationBar: true });

我的 cordova.xml 文件有如此配置白名单:

My cordova.xml file has whitelists configured as such:

<access origin="http://127.0.0.1*"/> <!-- allow local pages -->

...我不怀疑应该是一个问题。然而,交换来源的基本测试=*产生的行为没有任何变化。

...which I don't suspect should be a problem. However, a basic test of swapping origin=".*" yielded no change in behaviour.

我也检查了HTTP和HTTPS标头的Twitter的意图登陆页面。似乎没有要任何东西脱节的 - 他们是相同的,除了严格-运输-Security头用于HTTPS,这在其他地方工作(例如Github上)

I've also examined the HTTP and HTTPS headers for the Twitter intent landing pages. There doesn't appear to be anything out of line - they're identical, except for the Strict-Transport-Security header for HTTPS, which works elsewhere (e.g. Github).

请帮帮忙!

推荐答案

的ChildBrowser不受白名单的约束。白名单仅用于保持主PhoneGap的应用程序运行code信任域之外。

The ChildBrowser is not bound by the whitelist. The whitelist is only used to keep the main PhoneGap app from running code outside of trusted domains.

我相信,如果你去获得最新ChildBrowser code来自Android的,你会不会再碰到这个问题。我们最近做了一些改动,使其更加强劲。

I'm confident if you go get the latest ChildBrowser code from Android you won't have run into this problem anymore. We've made some changes recently that make it more robust.

此外,利比有一个很好的教程集成的Twitter和ChildBrowser。

Also, Libby has a good tutorial integrating Twitter and the ChildBrowser.

http://www.mobiledevelopersolutions.com/home/start/twominutetutorials/tmt5p1

这篇关于PhoneGap的/科尔多瓦ChildBrowser将不会运行的Twitter网页意图(SSL?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆