{ "id": "121852", "key": "TIMOB-15616", "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": null, "resolutiondate": null, "created": "2013-10-30T23:41:51.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [ { "id": "15593", "description": "Release 3.1.3", "name": "Release 3.1.3", "archived": true, "released": true, "releaseDate": "2013-09-18" } ], "issuelinks": [], "assignee": null, "updated": "2018-02-28T20:03:34.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h3. Description:\r\nUser tried to load an html file located in the filesystem with an appended hash value (#value) but when trying to retrieve the value via window.location.hash this is null.\r\n\r\nh3. Test case:\r\n\r\nIndex.js\r\n{code}\r\n\r\n'use strict';\r\n\r\n(function (e) {\r\n var url = Ti.Filesystem.getResourcesDirectory() + 'html/index.html#myHash';\r\n $.webView.url = url;\r\n}());\r\n\r\n$.index.open();\r\n\r\n{code}\r\n\r\nindex.html\r\n{code}\r\n\r\nfunction updateHash() {\r\n document.getElementById('content').textContent =\r\n 'url: ' + document.URL +\r\n '\\nhash: ' + window.location.hash; \r\n}\r\n\r\n{code}\r\n\r\nh3. Output:\r\n[INFO] : url: file:///Users/mcota/Library/Application%20Support/iPhone%20Simulator/7.0/Applications/2FA2A5DA-7AA4-4FFA-86F3-D634BD77BB39/WebViewHash.app/html/index.html\r\n[INFO] : hash:\r\n\r\nh3. Additional Comments:\r\nThis only happens when the url is from the local filesystem, when the url is an http:// address returns the hash value correctly.\r\n\r\nh3. Work-around:\r\n", "attachment": [], "flagged": false, "summary": "iOS: Hash value empty for local file system URL in WebView", "creator": { "name": "mcota", "key": "mcota", "displayName": "Marco Cota", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mcota", "key": "mcota", "displayName": "Marco Cota", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "Product: Titanium SDK\r\nTitanium SDK: Mobile 3.1GA\r\nPlatform OS: iOS\r\nPlatform OS Version: iOS 7", "comment": { "comments": [ { "id": "279916", "author": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~btran] - if a work-around was proposed to the customer, please post it to the JIRA.", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-11-15T23:30:32.000+0000", "updated": "2013-11-15T23:30:32.000+0000" }, { "id": "280717", "author": { "name": "btran", "key": "btran", "displayName": "Betty Tran", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The workaround we proposed involves setting the window.location.hash as part of a fireEvent.\r\n\r\nindex.js\r\n\r\n{code}\r\nvar url = Ti.Filesystem.getResourcesDirectory() + 'html/index.html?#=myHash';\r\n\r\n$.webView.url = url;\r\n setTimeout(doEvent,2000);\r\n function doEvent(){\r\n Ti.App.fireEvent('webview>>hash',{hash:url.split('#')[1]});\r\n }\r\n\r\nmain.js\r\n\r\nwindow.onhashchange = updateHash;\r\n\r\nTi.App.addEventListener('webview>>hash',function(e){\r\n\r\n window.location.hash = e.hash;\r\n });\r\n\r\nfunction updateHash() {\r\n document.getElementById('content').textContent =\r\n 'url: ' + document.URL +\r\n '\\nhash: ' + window.location.hash;\r\n }\r\n{code}", "updateAuthor": { "name": "btran", "key": "btran", "displayName": "Betty Tran", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-11-22T11:20:35.000+0000", "updated": "2013-11-22T11:20:57.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }