cordova插件InAppBrowser在iPhone上显示url和Done、Back/Forward键的问题

I am currently building a News Aggregator App and I am using InAppBrowser for people to read the articles. Now, my questions is:
[color=red]Can I remove the URL and Navigation Bar?
Also, can I change the "Done" button text?[/color]


[img]http://dl2.iteye.com/upload/attachment/0100/7748/4b9a46f6-2d58-3006-919f-b68d4d027243.png[/img]

To remove the URL, just set the location option to "no".

var ref = window.open('http://apache.org', '_blank', 'location=no');


Recent versions of Cordova/PhoneGap now allow you to change the 'Done' button text by adding a 'closebuttoncaption' option.

var ref = window.open('http://apache.org', '_blank', 'closebuttoncaption=My Button Name');


As danw mentioned, you can now also remove the entire toolbar by setting the 'toolbar' option to "no".

var ref = window.open('http://apache.org', '_blank', 'toolbar=no');


However, removing the toolbar means both the 'Back/Forward' buttons and the 'Done' button will no longer show. This makes it difficult to exit out of the InAppBrowser.

If you want to keep the 'Done' button, but get rid of the 'Back/Forward' buttons in all of your InAppBrowsers, you can modify the source code for the InAppBrowser plugin as follows.

For iOS, open the following file

YOURAPPNAME/platforms/ios/YOURAPPNAME/Plugins/org.apache.cordova.inappbrowser/src/ios/CDVInAppBrowser.m


and change the following line of code from:

[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton, self.backButton, fixedSpaceButton, self.forwardButton]];

to:

[self.toolbar setItems:@[self.closeButton, flexibleSpaceButton]];


Then build your project again using the command line.

InAppBrowser官网详解:
[url]http://cordova.apache.org/docs/en/3.3.0/cordova_inappbrowser_inappbrowser.md.html[/url]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值