[TIMOB-23186] Android: Webview request send out beforeload event is excuted on Webview
GitHub Issue | n/a |
Type | Improvement |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-05-17T23:45:26.000+0000 |
Affected Version/s | Release 5.2.2 |
Fix Version/s | Release 5.4.0, Release 5.3.2 |
Components | Android |
Labels | android |
Reporter | Rakhi Mitro |
Assignee | Ashraf Abu |
Created | 2016-04-11T08:41:54.000+0000 |
Updated | 2017-01-10T09:14:45.000+0000 |
Description
Just load any HTML url in webview and call the webview.stoploading in beforeload event of webview. Customer has blocked the "terms of use" and "privacy policy" links in "beforeload" event of the web view. The webView stops loading but the link is traced in Proxy.
*Test code:* Sample code is attached.
*Test steps:*
* Import the app.
* Click on "terms of use" and "privacy policy” links and see the requests on proxy.
*Expected Behavior :*
Webview.stoploading should have prevented the request for the link clicked.
*Actual Behavior :*
By clicking on "terms of use" and "privacy policy” links, requests are sent out on proxy(by the IP address)
Attachments
More information will be greatly appreciated. Is this a regression? Does it work on Android < 6.0? Does it work correctly on iOS? Thanks.
Let me check. Will keep you updated.
[~cng] Tested and got the same result on Android 4.4.2 and iPad-iOS 8.4 device. Thanks
Ok so you mean this is an issue seen on both iOS and Android. I haven't opened the app to see in detail but, isn't it a bit odd to block elements of a html BEFORE load on a web view? that means the "terms of use" and "privacy policy" doesn't exist during the "beforeload" event because the html itself isn't loaded. so I don't think it's possible to block something that's not known until it's "loaded". So this may not be a valid issue for the SDK, but rather the implementation should be done in another way? it'll be much appreciated if you can verify this first. If you really can't, then I will get someone in the SDK team to investigate further. Thanks for your assistance.
Yes, but funny thing here is the proxy trace, it should not exist if the before load is blocking it, also this is happening for any webpage
Classic code to reproduce:-
Based on this: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.WebView-event-beforeload The request is already actually sent. The
beforeload
event is before it loads the content into the webview.stopLoading()
stops the loading of the content into the webview. At this point, it has content and request is done. This is how it is behaving.[~rmitro] As mentioned above, the behaviour is how it's suppose to work. Is there a need for the behaviour as mentioned in the ticket?
PR: https://github.com/appcelerator/titanium_mobile/pull/7954
PR merged.
Hello, I have tested the issue with
SDK 5.4.0.v20160429102159
and able to reproduce. *Steps:* 1. Import the test project. 2. Build and run on Android Device. 3. When the web page is loaded click on "terms of use" or "privacy policy”. 4. By clicking on "terms of use" and "privacy policy” links, requests are sent out on proxy although the corresponding pages are not loaded. When the links are clicked following log is produced in proxy server. *Proxy Server Log:*Thanks *Environment*: *Device info:* Nexus7 (android 6.0.1) *Node.js Version:* 0.12.7 *npm Version:* 2.11.3 *Titanium SDK:* 5.4.0.v20160429102159 *Java Development Kit Version:* 1.8.0_73 *Titanium CLI Version:* 5.0.5 *Appcelerator CLI Version:* 5.2.2 *Appcelerator Studio:* 4.5.0
[~nsalahin] Which code are you using?
Reopened the ticket for the improvement. PR: https://github.com/appcelerator/titanium_mobile/pull/8002
PR has been reviewed and merged.
[~msamah], Many thanks for your help. I am sure client will be happy and will keep you posted.
Verified the improvement. Works as expected. Closing. Environment: Appc Studio : 4.7.0.201607111053 Ti SDK : 5.4.0.v20160712013704 Ti CLI : 5.0.9 Alloy : 1.9.1 MAC El Capitan : 10.11.5 Appc NPM : 4.2.8-1 Appc CLI : 5.4.0-33 Node: 4.4.4 Nexus 6 - Android 6.0.1