{ "id": "83314", "key": "TIMOB-6426", "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": "12090", "description": "", "name": "Sprint 2011-50", "archived": true, "released": true, "releaseDate": "2011-12-19" }, { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" }, { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-12-13T16:13:45.000+0000", "created": "2011-12-01T16:05:05.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "stage" ], "versions": [ { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" } ], "issuelinks": [], "assignee": { "name": "adecena", "key": "adecena", "displayName": "Anthony Decena", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-03T23:16:55.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": "11500", "name": "MobileWeb", "description": "Mobile Web (HTML) Platform" } ], "description": "Ti.Platform.canOpenURL() just returns true for any and all urls. Ti.Platform.openURL() performs an window.open() for all URLs.\r\n\r\nFor canOpenURL(), say true if url does NOT contain a \":\" or it does contain a \":\" but is http or https, otherwise false. It would also be nice to have checks for if running in a simulator, then blacklist known unsupported protocols. For example, iPhone simulator doesn't support mailto, tel, sms, itms, itms-apps.\r\n\r\nFor openURL(), simply do something like:\r\n\r\n canOpenURL(url) ? window.open(url) : window.location = url;\r\n\r\nProblem with window.location is we may accidentally redirect the browser to a malformed mailto: or something. Perhaps we need to create a dummy iframe and target it by name with window.open()?\r\n\r\nNote: this needs to be tested on all browsers including devices (ios & android) and simulators.", "attachment": [ { "id": "24501", "filename": "platform_app.js", "author": { "name": "adecena", "key": "adecena", "displayName": "Anthony Decena", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-07T08:17:27.000+0000", "size": 2533, "mimeType": "application/x-javascript" } ], "flagged": false, "summary": "MobileWeb: Add support for non-http protocols to Ti.Platform.openURL() and Ti.Platform.canOpenURL()", "creator": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "environment": null, "comment": { "comments": [ { "id": "174509", "author": { "name": "adecena", "key": "adecena", "displayName": "Anthony Decena", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The test for the ':' in the canOpenURL() function would fail on a url with no protocol but with a port, ie: someplace.com:8080 which would not be uncommon in a mobile web app.\r\nI'll try and come up with something that covers as much as possible while still remaining rather simple.", "updateAuthor": { "name": "adecena", "key": "adecena", "displayName": "Anthony Decena", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-01T16:45:52.000+0000", "updated": "2011-12-01T16:46:07.000+0000" }, { "id": "174511", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "Also need to support :// which means use the current protocol.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2011-12-01T16:56:18.000+0000", "updated": "2011-12-01T16:56:18.000+0000" }, { "id": "174532", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "I did some research and if you detect a URL that can be opened by local process (i.e. iTunes, mail, or something), it says to do it in a setTimeout:\r\n\r\n{code}\r\nsetTimeout(function () {\r\n window.location.href = url;\r\n}, 1);\r\n{code}\r\n\r\nThis is probably to allow the UI to refresh, perhaps in the event of a mouse up event on a button.\r\n\r\nYou may want to checkout http://r.mzstatic.com/htmlResources/880B/web-storefront-base.jsz and http://r.mzstatic.com/htmlResources/880B/web-storefront-preview.jsz.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2011-12-01T22:12:58.000+0000", "updated": "2011-12-01T22:12:58.000+0000" }, { "id": "174677", "author": { "name": "adecena", "key": "adecena", "displayName": "Anthony Decena", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I added a uri parser for the canOpenURL() method. I also fixed the issue where urls were getting incorrectly assigned to open in the current window. Commit is here: \r\nhttps://github.com/Mindelusions/titanium_mobile/commit/43764ed6634728de6960da5e7d903867eb0cf2d6\r\nTest page is here: http://mindelusions.com/boneyard/ti_mobileweb/platform_url_test.html\r\n", "updateAuthor": { "name": "adecena", "key": "adecena", "displayName": "Anthony Decena", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-02T22:47:26.000+0000", "updated": "2011-12-02T22:47:26.000+0000" }, { "id": "409037", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-03T23:16:55.000+0000", "updated": "2017-03-03T23:16:55.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }