{ "id": "174292", "key": "TIMOB-27522", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "20033", "name": "Release 9.0.0", "archived": false, "released": true, "releaseDate": "2020-03-18" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-12-10T16:18:09.000+0000", "created": "2019-10-24T15:30:33.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "engSchedule", "parity" ], "versions": [ { "id": "20884", "name": "Release 8.2.1", "archived": false, "released": true, "releaseDate": "2019-10-25" } ], "issuelinks": [], "assignee": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2019-12-10T16:18:09.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "What happens:\r\n\r\n- on iOS both the {{onlink}} function and the {{beforeload}} event are called when setting {{html}}, while on Android this happens only for {{beforeload}}.\r\n\r\n- on iOS both the {{onlink}} function and the {{beforeload}} event are called also for embeds (like iframe) while on Android this not happen at all.\r\n\r\nThis is causing me some trouble working on iOS because of \"false positive\" events that I need to distinguish as user clicks or normal page loading.\r\n\r\nI'd like to suggest a PR where\r\n\r\n*solution 1:*\r\n\r\n- iOS will send {{onlink}} only when navigation type is {{WKNavigationTypeLinkActivated}}\r\n- beforeload event will expose the {{isMainFrame}} indication to indicate if it was generated on the main page or an iframe.\r\n\r\n_or:_\r\n\r\n*solution 2:*\r\n\r\n- iOS will send {{onlink}} only when navigation type is {{WKNavigationTypeLinkActivated}}\r\n- beforeload event is generated only if {{navigationAction.targetFrame.isMainFrame}} is true\r\n\r\nAt the moment I've implemented in the PR the first solution, since iOS is already a little different from Android because it already exposes the platform specific attribute {{navigationType}}\r\n\r\nSee the [PR|https://github.com/appcelerator/titanium_mobile/pull/11295]", "attachment": [ { "id": "67086", "filename": "app.js", "author": { "name": "gmandolini", "key": "gmandolini", "displayName": "Giorgio Mandolini", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-10-24T15:20:23.000+0000", "size": 1019, "mimeType": "text/javascript" }, { "id": "67085", "filename": "logs.txt", "author": { "name": "gmandolini", "key": "gmandolini", "displayName": "Giorgio Mandolini", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-10-24T15:21:58.000+0000", "size": 2850, "mimeType": "text/plain" } ], "flagged": false, "summary": "WebView: onlink and beforeload are not consistent across platforms", "creator": { "name": "gmandolini", "key": "gmandolini", "displayName": "Giorgio Mandolini", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "gmandolini", "key": "gmandolini", "displayName": "Giorgio Mandolini", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "452246", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The \"onlink\" callback is only intended to be invoked when the end-user taps/click on a link. It's not supposed to be invoked when loading a page via the \"url\"/\"html\" properties or when navigation programmatically via the HTML's own JavaScript code. If this is the behavior that you are seeing on iOS, then the native iOS code needs to be changed to match Android's behavior. (Android can't replicate iOS' WebView behavior in this case anyways.)\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-10-24T18:13:52.000+0000", "updated": "2019-10-24T18:13:52.000+0000" }, { "id": "452260", "author": { "name": "gmandolini", "key": "gmandolini", "displayName": "Giorgio Mandolini", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks for the clarification Joshua, actually the iOS webview calls the onlink callback too many times (details on logs), so it would be better to implement the solution #1 and stop iOS to send events when they are not user generated.", "updateAuthor": { "name": "gmandolini", "key": "gmandolini", "displayName": "Giorgio Mandolini", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-10-25T12:39:07.000+0000", "updated": "2019-10-25T12:39:35.000+0000" }, { "id": "452500", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~gmandolini]'s PR can be found here:\r\nhttps://github.com/appcelerator/titanium_mobile/pull/11295\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-11-06T18:30:15.000+0000", "updated": "2019-11-06T18:30:26.000+0000" }, { "id": "452938", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed. Webview onLink is not called along with beforeLoad when setting html. It is fired when a link in the html is clicked and the link is being navigated.", "updateAuthor": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-11-27T22:43:31.000+0000", "updated": "2019-11-27T22:43:31.000+0000" }, { "id": "452939", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Waiting for Jenkins build to pass", "updateAuthor": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-11-27T22:44:29.000+0000", "updated": "2019-11-27T22:44:29.000+0000" }, { "id": "453029", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR Merged.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-12-04T21:36:05.000+0000", "updated": "2019-12-04T21:36:05.000+0000" }, { "id": "453131", "author": { "name": "ssaddique", "key": "ssaddique", "displayName": "Sohail Saddique", "active": true, "timeZone": "Europe/London" }, "body": "Fix verified on build: 9.0.0.v20191209135132. onlink does not fire unnecessarily unless by manual user navigation.\r\n\r\nTicket closed.", "updateAuthor": { "name": "ssaddique", "key": "ssaddique", "displayName": "Sohail Saddique", "active": true, "timeZone": "Europe/London" }, "created": "2019-12-10T16:17:56.000+0000", "updated": "2019-12-10T16:17:56.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }