Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26835] iOS: Unable to get call pop menu from a webView

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2019-04-04T13:53:43.000+0000
Affected Version/sRelease 8.0.0
Fix Version/sRelease 8.0.1
ComponentsiOS
LabelsengSchedule, regression
ReporterSamir Mohammed
AssigneeVijay Singh
Created2019-02-18T14:47:04.000+0000
Updated2019-04-04T13:53:43.000+0000

Description

This is a regression from 7.5.0.GA. When pressing the call me button on an application using webView the call popup is no longer shown. *Test Code*
var win = Titanium.UI.createWindow({
	backgroundColor:'white'
});
win.add(Ti.UI.createWebView({
	top:20,
	html:'<body><a href="tel:555-123-4567">Call me</a></body>',
	handlePlatformUrl:true
}));
win.open();
*Expected result:* Above test case should show a pop up asking the user to make a call *Actual result:* No pop is shown.

Comments

  1. Vijay Singh 2019-02-20

    [~smohammed] In 8.0.0 we are using WKWebView instead of UIWebView to implement Ti.UI.WebView. So in some cases behavior is a bit different. We have to use 'allowedURLSchemes' property for same to work. Best way to implement the same is -
       var win = Titanium.UI.createWindow({
           backgroundColor:'white'
       });
       var webview = Ti.UI.createWebView({
           top:20,
           html:'<body><a href="tel://555-123-4567">Call me</a></body>',
           allowedURLSchemes:["tel"]
       });
       win.add(webview);
       win.open();
       
       webview.addEventListener('handleurl', function(e) {
           var handler = e.handler;
           Ti.Platform.openURL(e.url);
           handler.invoke(Ti.UI.iOS.ACTION_POLICY_CANCEL); 
       });
       
  2. Vijay Singh 2019-03-21

    PR(master) - https://github.com/appcelerator/titanium_mobile/pull/10793 PR(8_0_X) - https://github.com/appcelerator/titanium_mobile/pull/10794
  3. Jan Vennemann 2019-03-28

    [~jquick], is there something similar to the allowedURLSchemes property and handleurl event on Android to dynamically decide which URLs to handle?
  4. Joshua Quick 2019-03-28

    [~jvennemann], in Titanium 7.5.0, we added a new "onlink" callback to WebView on Android and iOS. https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.WebView-property-onlink The WebView will do a blocking call on the "onlink" callback whenever you tap on a link. If you return true from the callback, then the WebView will proceed to load the URL. If the callback returns false, then the WebView won't load the link. This feature's main intention is to allow the app developer to invoke native things from say a custom URL scheme. Such as display a native window/dialog.
  5. Joshua Quick 2019-03-28

    Here is an example on how to use "onlink". It works on both Android and iOS.
       var htmlText =
       		'<!DOCTYPE html>\n' +
       		'<html>\n' +
       		'	<head>\n' +
       		'		<meta name="viewport" content="width=device-width, initial-scale=1.0">\n' +
       		'	</head>\n' +
       		'	<body>\n' +
       		'		<p>WebView "onlink" Test</p>\n' +
       		'		<a href="mylink://show/alert1">Show Alert 1</a>\n' +
       		'		<br/>\n' +
       		'		<br/>\n' +
       		'		<br/>\n' +
       		'		<a href="mylink://show/alert2">Show Alert 2</a>\n' +
       		'		<br/>\n' +
       		'		<br/>\n' +
       		'		<br/>\n' +
       		'		<a href="https://www.youtube.com">Go to YouTube</a>\n' +
       		'	</body>\n' +
       		'</html>\n';
       
       var window = Ti.UI.createWindow();
       var webView = Ti.UI.createWebView({
       	html: htmlText,
       	onlink: function(e) {
       		switch (e.url) {
       			case "mylink://show/alert1":
       				alert("This is alert 1.");
       				return false;
       			case "mylink://show/alert2":
       				alert("This is alert 2.");
       				return false;
       		}
       		return true;
       	},
       });
       window.add(webView);
       window.open();
       
  6. Samir Mohammed 2019-04-03

    FR Passed, waiting on Jenkins builds.
  7. Christopher Williams 2019-04-03

    Merged to 8_0_X and master
  8. Samir Mohammed 2019-04-04

    *Closing ticket.* Fix verified in SDK version 8.0.1.v20190403071846 and SDK version 8.1.0.v20190325115012. Test and other information can be found at: PR(master) - https://github.com/appcelerator/titanium_mobile/pull/10793 PR(8_0_X) - https://github.com/appcelerator/titanium_mobile/pull/10794

JSON Source