Ionic InAppBrowser 无 done/close 按钮 iOS
Ionic InAppBrowser no done/close button iOS
请参阅我在 inappbrowser 中使用的附件片段。我在 location 和 toolbar=yes 中使用了 '_blank' link 在 inappbrowser 中打开,但没有后退按钮或完成按钮。
我试过用“_self”替换“_blank”,但这没有任何区别。
由于这对我不起作用,我决定最好在系统浏览器中打开 link 并将“_self”替换为“_system”,但这不起作用。 link 根本打不开。
当我在浏览器中测试它时,所有 3 运行 都很好,但是当在 iOS 模拟器上模拟它或在 iOS 设备上测试时,我面临上述问题。
我阅读了很多关于 stack overflow 和 ionic 论坛的帖子,并尝试了几乎所有提供的解决方案,但 none 对我有用。将 ionic 与 iOS 一起使用似乎是一个错误。有人有其他解决方案吗?
〈a ng-href="https://facebook.com" target="_self" ng-click="cordova.InAppBrowser.open('https://facebook.com','_self', 'location=yes, toolbar=yes'); return false;"〉test〈/a〉
Ionic 1,Xcode 版本 8.3.2,iOS 9,cordova-plugin-inappbrowser spec="^1.7.1"
我已经检查了我以前的应用程序。代码工作正常。
查看此 github 代码库以获取示例代码:https://github.com/varunaaruru/ionic1-inappbrowser
安装插件:
ionic cordova plugin add cordova-plugin-inappbrowser
在 html 文件中:
<a href="#" onclick="window.open('http://www.facebook.com', '_system', 'location=yes'); return false;">
click here
</a>
您可以使用 blank
或 self
代替 system
这解决了我的问题。在您的 config.xml 文件中添加以下代码(如果尚不存在):
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
根据您在项目中使用的超链接添加 href。
添加以下行:
const iosoption: InAppBrowserOptions = {
zoom: 'no',
location:'yes',
toolbar:'yes',
clearcache: 'yes',
clearsessioncache: 'yes',
disallowoverscroll: 'yes',
enableViewportScale: 'yes'
}
if (this.platform.is('ios')) {
browser = this.inAppBrowser.create(this.ValidateUsers, '_blank', iosoption);
}
请参阅我在 inappbrowser 中使用的附件片段。我在 location 和 toolbar=yes 中使用了 '_blank' link 在 inappbrowser 中打开,但没有后退按钮或完成按钮。 我试过用“_self”替换“_blank”,但这没有任何区别。 由于这对我不起作用,我决定最好在系统浏览器中打开 link 并将“_self”替换为“_system”,但这不起作用。 link 根本打不开。 当我在浏览器中测试它时,所有 3 运行 都很好,但是当在 iOS 模拟器上模拟它或在 iOS 设备上测试时,我面临上述问题。
我阅读了很多关于 stack overflow 和 ionic 论坛的帖子,并尝试了几乎所有提供的解决方案,但 none 对我有用。将 ionic 与 iOS 一起使用似乎是一个错误。有人有其他解决方案吗?
〈a ng-href="https://facebook.com" target="_self" ng-click="cordova.InAppBrowser.open('https://facebook.com','_self', 'location=yes, toolbar=yes'); return false;"〉test〈/a〉
Ionic 1,Xcode 版本 8.3.2,iOS 9,cordova-plugin-inappbrowser spec="^1.7.1"
我已经检查了我以前的应用程序。代码工作正常。
查看此 github 代码库以获取示例代码:https://github.com/varunaaruru/ionic1-inappbrowser
安装插件:
ionic cordova plugin add cordova-plugin-inappbrowser
在 html 文件中:
<a href="#" onclick="window.open('http://www.facebook.com', '_system', 'location=yes'); return false;">
click here
</a>
您可以使用 blank
或 self
代替 system
这解决了我的问题。在您的 config.xml 文件中添加以下代码(如果尚不存在):
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
根据您在项目中使用的超链接添加 href。
添加以下行:
const iosoption: InAppBrowserOptions = {
zoom: 'no',
location:'yes',
toolbar:'yes',
clearcache: 'yes',
clearsessioncache: 'yes',
disallowoverscroll: 'yes',
enableViewportScale: 'yes'
}
if (this.platform.is('ios')) {
browser = this.inAppBrowser.create(this.ValidateUsers, '_blank', iosoption);
}