{ "id": "79927", "key": "AC-3157", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "8", "description": "", "name": "Needs more info" }, "resolutiondate": "2011-12-26T10:12:11.000+0000", "created": "2011-09-01T09:40:31.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "updated": "2016-03-08T07:48:13.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "h2. Problem\r\n\r\nwebView is undefined in load event handler for WebView instance\r\n\r\nh2. Test case\r\n\r\n# create a window\r\n# add webview to this window and tell this webview to use a local html file\r\n# add a load event handler to this webview\r\n# in this event handler, examine the webview.html or even the html within the source of the event object\r\n# local file has a link to a remote file; which when clicked does get loaded *BUT still no data in webview.html*\r\n\r\n\r\nBTW: For sake of simplicity, i used an html page that i normally use for no connection and simply added a w3c link to it; in fact, network connection etc. are fine.\r\n\r\n{code:lang=javascript}\r\nTi.UI.setBackgroundColor('#000');\r\n\r\nvar win1 = Titanium.UI.createWindow({ \r\n title:'HTML Test',\r\n backgroundColor:'#fff'\r\n});\r\nvar localUrl = 'noconn.html';\r\nvar webView = Ti.UI.createWebView({url:localUrl})\r\nwebView.addEventListener('load', onLoad);\r\nfunction onLoad(evt) {\r\n if (webView.url.search(localUrl) >= 0) {\r\n Ti.API.info('LOCAL: +++++++++++++++++++++++++');\r\n Ti.API.info(evt.source.html);\r\n Ti.API.info('LOCAL: +++++++++++++++++++++++++');\r\n Ti.API.info(webView.html);\r\n }\r\n else {\r\n Ti.API.info(\" !! NOT local html file -- \" + webView.url);\r\n Ti.API.info('REMOTE: +++++++++++++++++++++++++');\r\n Ti.API.info(evt.source.html);\r\n Ti.API.info('REMOTE: +++++++++++++++++++++++++');\r\n Ti.API.info(webView.html);\r\n }\t\r\n}\r\n\r\nwin1.add(webView);\r\nwin1.open();\r\n{code}\r\n\r\n{code:lang=html|title=noconn.html}\r\n\r\n\r\n\r\n \r\n \r\n No Data Connection\r\n \r\n \r\n \r\n

Unable to raise the server due to connectivity issues.

\r\n

Please try back later.

\r\n Go Remote!\r\n \r\n \r\n \r\n\r\n\r\n{code}\r\n\r\n{code:lang=none|title=console output}\r\nD/KrollContext( 291): (kroll$1: app://app.js) [101,1458] Running evaluated script: file:///android_asset/Resources/app.js\r\nI/TiRootActivity( 291): (main) [0,0] checkpoint, on root activity resume. context = org.appcelerator.titanium.TiContext@43e628a8\r\nW/TiAnalyticsSvc( 291): (Thread-11) [39,39] Analytics Service Started\r\nI/global ( 291): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.\r\nI/global ( 291): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.\r\nD/dalvikvm( 291): GC_FOR_MALLOC freed 2892 objects / 323576 bytes in 152ms\r\nI/global ( 291): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.\r\nI/TiAnalyticsSvc( 291): (Thread-11) [1784,1823] Sending 2 analytics events.\r\nI/ActivityManager( 60): Displayed activity com.healthtrio.test/.HtmltestActivity: 6794 ms (total 6794 ms)\r\nI/TiAPI ( 291): (kroll$1: app://app.js) [1360,3183] LOCAL: +++++++++++++++++++++++++\r\nI/TiAPI ( 291): (kroll$1: app://app.js) [1,3184] undefined\r\nI/TiAPI ( 291): (kroll$1: app://app.js) [1,3185] LOCAL: +++++++++++++++++++++++++\r\nI/TiAPI ( 291): (kroll$1: app://app.js) [1,3186] undefined\r\nD/dalvikvm( 291): GC_FOR_MALLOC freed 5513 objects / 387224 bytes in 202ms\r\nD/dalvikvm( 291): GC_FOR_MALLOC freed 1253 objects / 63240 bytes in 53ms\r\nW/TiAnalyticsSvc( 291): (Thread-11) [2218,5404] Stopping Analytics Service\r\nD/dalvikvm( 118): GC_EXPLICIT freed 703 objects / 39600 bytes in 58ms\r\nD/dalvikvm( 291): GC_FOR_MALLOC freed 2351 objects / 144400 bytes in 139ms\r\nI/TiAPI ( 291): (kroll$1: app://app.js) [5382,10786] !! NOT local html file -- http://www.w3schools.com/\r\nI/TiAPI ( 291): (kroll$1: app://app.js) [1,10787] REMOTE: +++++++++++++++++++++++++\r\nI/TiAPI ( 291): (kroll$1: app://app.js) [1,10788] undefined\r\nI/TiAPI ( 291): (kroll$1: app://app.js) [1,10789] REMOTE: +++++++++++++++++++++++++\r\nI/TiAPI ( 291): (kroll$1: app://app.js) [0,10789] undefined\r\n{quote}\r\n{code}\r\n\r\nh2. Related Discussions\r\n\r\nQ&A: http://developer.appcelerator.com/question/124990/webviewhtml-is-undefined-in-load-event-handler#answer-217881\r\n", "attachment": [ { "id": "22774", "filename": "device.PNG", "author": { "name": "sheshmantha", "key": "sheshmantha", "displayName": "Sheshadri Mantha", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-01T09:40:31.000+0000", "size": 25908, "mimeType": "image/png" }, { "id": "22773", "filename": "htmltest-src.zip", "author": { "name": "sheshmantha", "key": "sheshmantha", "displayName": "Sheshadri Mantha", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-01T09:40:31.000+0000", "size": 748385, "mimeType": "application/zip" } ], "flagged": false, "summary": "Android: UI - webView is undefined in load event handler for WebView instance", "creator": { "name": "sheshmantha", "key": "sheshmantha", "displayName": "Sheshadri Mantha", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "sheshmantha", "key": "sheshmantha", "displayName": "Sheshadri Mantha", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "* Titanium Studio, build: 1.0.4.201108101535 Date: 10 August 2011, 15:39:05\r\n* Titanium SDK: 1.7.2\r\n* Platform: Android 2.2 Emulator only\r\n* Device: Android 2.2 (see image)\r\n* Host OS: Windows 7", "comment": { "comments": [ { "id": "177197", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Sheshadri\r\n\r\nAs this is a duplication of TIMOB-974, I will mark it resolved. You may reopen it if you disagree.\r\n\r\nHowever, also take a note of the changes I made to ensure that the ticket meets the [How to Submit a Bug Report|https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report] guide (before I realised it was a duplicate). Please follow this when raising any tickets in future.\r\n\r\nCheers", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-26T10:11:59.000+0000", "updated": "2011-12-26T10:11:59.000+0000" }, { "id": "183535", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Closing due to inactivity. If this issue still exists, please raise a new ticket, including all the information in the [JIRA Ticket Checklist|https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist] to ensure that we can escalate it quickly. Read [How to Submit a Bug Report|https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report] if you have not read it before, and always start a ticket using the [JIRA Ticket Template|https://wiki.appcelerator.org/display/guides/JIRA+Ticket+Template].\r\n\r\nThanks in advance", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2012-02-17T02:23:01.000+0000", "updated": "2012-02-17T02:23:01.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }