[AC-756] WebView.evalJS does not return the correct value when the expression is suffixed by semicolon
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Needs more info |
Resolution Date | 2015-09-15T04:07:01.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Titus Wiguno |
Assignee | Shak Hossain |
Created | 2014-08-22T18:04:12.000+0000 |
Updated | 2016-03-08T07:37:01.000+0000 |
Description
I'm using social.js to make integrated social-network login to my app. Apparently this line in social.js (line 381 or so) prevented the twitter login to behave as it should:
var response = e.source.evalJS('(p = document.getElementById("oauth_pin")) && p.innerHTML;');
I managed to work it out by removing the semicolon in the expression to eval.
hi, I think you don't need a semicolon in string, Like the example in Document. Ref: [http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.WebView-method-evalJS] Regards, Shuo
Hello, I have tested this issue in updated environment. [evalJS ](http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.WebView-method-evalJS) function evaluates a JavaScript expression inside the context of the web view and optionally, returns a result.The JavaScript expression must be passed in as a I think you don't need a semicolon in string. This is not a bug for latest Appcelerator version. Not sure if this is still an issue for you. It doesn't appear to be based on our latest tests. Please let me know how I can help further. *Test Environments:* CLI Version :4.0.1 Titanium SDK Version:4.1.0.GA Android: Google Galaxy Nexus:4.1.1 - API 16 - 720x1280 Appc Studio: Appcelerator Studio, build: 4.1.1.201507141126 Alloy: 1.7.3 *Test code:* *app.js*
*test.html*
*Test Steps:*
Create web view on app.js .
Create a html page text.html .
Add load event listener on window
Call evalJS function into load event.
Run the project
*Test Result:* Project builds successfully .WebView.evalJS does return the correct value when the expression is not suffixed by semicolon and with semicolon it works as expected. *Ti logs:* [WARN] : EGL_genymotion: eglSurfaceAttrib not implemented [INFO] : # of response with semicolon -> 19 [INFO] : # of of response without semicolon -> 19 [INFO] : APSAnalyticsService: Analytics Service Started [INFO] : APSAnalyticsService: Stopping Analytics Service Thanks