{ "id": "172916", "key": "TIMOB-26768", "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": [], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-03-20T18:04:05.000+0000", "created": "2019-01-25T18:01:42.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [ { "id": "20238", "description": "", "name": "Release 7.5.0", "archived": false, "released": true, "releaseDate": "2018-11-15" } ], "issuelinks": [], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2019-03-20T18:04: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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "Hello, \r\nWe have in our application a webview which is loading some links that redirect the user to some PDF files. We know that the Android browser has some issues with PDFs and as a workaround, we use the beforeload event to catch the URL and open the PDFs using other means. \r\nThe problem that we see is that the event is only being triggered using an emulator. If we switch to a physical device (we tried on a Pixel 1 and on a Galxy S9) the event is not triggered but ONLY with the links that redirect the user to a PDF. If the link sends the user to a regular html file it works as expected. \r\n\r\nTest Code:\r\n{code}\r\n$.index.open();\r\n\r\nfunction init(){\r\n var webUrl = 'Open PDF\r\n \t
Open regular url';\r\n $.webView.html = webUrl;\r\n}\r\n\r\ninit();\r\n\r\n$.webView.addEventListener('beforeload', function(_evt){\r\n alert(_evt.url);\r\n});\r\n{code}\r\nTest Environemnt :\r\n{code}\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.13.6\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 8589934592\r\n\r\nNode.js\r\n Node.js Version = 10.14.1\r\n npm Version = 6.4.1\r\n\r\nTitanium CLI\r\n CLI Version = 5.1.1\r\n\r\nTitanium SDK\r\n SDK Version = 7.5.0.GA\r\n SDK Path = /Users/user/Library/Application Support/Titanium/mobilesdk/osx/7.5.0.GA\r\n Target Platform = android\r\n{code}\r\nPlease take a look on attached screenshot.\r\n", "attachment": [ { "id": "66110", "filename": "Screenshot_20190125-231435.jpg", "author": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "created": "2019-01-25T18:01:38.000+0000", "size": 54011, "mimeType": "image/jpeg" }, { "id": "66109", "filename": "Screenshot_20190125-231442.jpg", "author": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "created": "2019-01-25T18:01:39.000+0000", "size": 75896, "mimeType": "image/jpeg" } ], "flagged": false, "summary": "Android : Beforeload event not working with PDF links on Android", "creator": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "subtasks": [], "reporter": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "environment": "Operating System\r\n Name = Mac OS X\r\n Version = 10.13.6\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 8589934592\r\n\r\nNode.js\r\n Node.js Version = 10.14.1\r\n npm Version = 6.4.1\r\n\r\nTitanium CLI\r\n CLI Version = 5.1.1\r\n\r\nTitanium SDK\r\n SDK Version = 7.5.0.GA\r\n SDK Path = /Users/Library/Application Support/Titanium/mobilesdk/osx/7.5.0.GA\r\n Target Platform = android", "closedSprints": [ { "id": 1123, "state": "closed", "name": "2019 Sprint 7", "startDate": "2019-03-18T17:27:25.993Z", "endDate": "2019-03-30T17:27:00.000Z", "completeDate": "2019-03-29T18:02:37.441Z", "originBoardId": 114 }, { "id": 1109, "state": "closed", "name": "2019 Sprint 3", "startDate": "2019-01-28T17:38:43.075Z", "endDate": "2019-02-09T17:38:00.000Z", "completeDate": "2019-02-08T21:37:29.498Z", "originBoardId": 114 }, { "id": 1112, "state": "closed", "name": "2019 Sprint 4", "startDate": "2019-02-11T16:16:38.316Z", "endDate": "2019-02-23T16:16:00.000Z", "completeDate": "2019-02-24T18:35:43.422Z", "originBoardId": 114 }, { "id": 1118, "state": "closed", "name": "2019 Sprint 5", "startDate": "2019-02-24T18:36:06.435Z", "endDate": "2019-03-08T18:36:00.000Z", "completeDate": "2019-03-07T22:19:47.057Z", "originBoardId": 114 }, { "id": 1119, "state": "closed", "name": "2019 Sprint 6", "startDate": "2019-03-03T22:20:00.193Z", "endDate": "2019-03-15T22:20:00.000Z", "completeDate": "2019-03-18T17:26:43.120Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "445858", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Since {{7.5.0}} the {{onlink}} event is available. They can catch PDF links like so:\r\n{code:js}\r\nlet window = Ti.UI.createWindow(),\r\n webView = Ti.UI.createWebView({\r\n html: 'Open PDF
Open Google',\r\n onlink: function (e) {\r\n if (e.url.endsWith('.pdf')) {\r\n alert('PDF: ' + e.url);\r\n return false; // do not open link\r\n }\r\n return true; // open link\r\n }\r\n });\r\nwindow.add(webView);\r\nwindow.open();\r\n{code}", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-02-05T18:53:12.000+0000", "updated": "2019-02-05T18:53:12.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }