cordova-plugin-inappbrowser干扰tel:和短信:

时间:2017-09-20 22:45:01

标签: cordova cordova-plugins inappbrowser

我在Cordova 7上,我注意到当我添加cordova-plugin-inappbrowser@1.7.1时,它会破坏我所拥有的class APIClient: URLSessionTaskDelegate { let session: URLSession! initializeSession() { // Create a new session with APIClient as the delegate session = URLSession(configuration: URLSessionConfiguration.default, delegate: self, delegateQueue: nil) } // Perform the request func fetchRecords(handler: () => void) { var request = URLRequest(url: URL(string: "http://127.0.0.1:8000/api/employee/records")!) request.setValue(retrieveToken(), forHTTPHeaderField: "Authorization") session.dataTask(with: request, completionHandler: handler).resume() } // Implement URLSessionTaskDelegate's HTTP Redirection method func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest, completionHandler: @escaping (URLRequest?) -> Void) { // Create a mutable copy of the new request, add the header, call completionHandler var newRequest = request newRequest.addValue(retrieveToken(), forHTTPHeaderField: "Authorization") completionHandler(newRequest) } } tel:链接iOS和Android上的sms:

这是我从JS做的电话:

window.open()

以下是我在config.xml中设置访问块的方法:

window.open(`sms:1231231234}`, '_self');

以下是我目前使用的插件:

<allow-intent href="tel:*" />
<allow-intent href="geo:*" />
<allow-intent href="mailto:*" />
<allow-intent href="sms:*" />
<allow-intent href="market:*" />
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<access origin="*" />

知道如何避免这种情况吗?所有我需要的InAppBrowser用于打开外部网页,但我需要手机链接才能继续工作。

2 个答案:

答案 0 :(得分:1)

使用这些插件让它工作:

call-number@https://github.com/Rohfosho/CordovaCallNumberPlugin.git#7d6e87569b101a0abb3ba9259f17bfec0b1719d7
cordova-plugin-camera@2.4.1
cordova-plugin-console@1.0.7
cordova-plugin-crosswalk-certificate@2.0.1
cordova-plugin-crosswalk-webview@2.3.0
cordova-plugin-device@1.1.6
cordova-plugin-email@1.2.6
cordova-plugin-google-analytics@1.7.11
cordova-plugin-inappbrowser@1.7.1
cordova-plugin-splashscreen@4.0.3
cordova-plugin-statusbar@2.2.3
cordova-plugin-whitelist@1.3.2
cordova-sms-plugin@0.1.11
ionic-plugin-keyboard@2.2.1

答案 1 :(得分:0)

您是否尝试将这些添加到配置文件?

<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" /> 

这对我有帮助。