[TIMOB-23327] iOS: Webview request send out beforeload event is excuted on Webview (Parity)
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-01-10T09:46:04.000+0000 |
Affected Version/s | Release 5.4.0, Release 5.2.2 |
Fix Version/s | Release 6.1.0 |
Components | Android, iOS |
Labels | Citi, supportTeam |
Reporter | Mostafizur Rahman |
Assignee | Vijay Singh |
Created | 2016-05-05T14:07:17.000+0000 |
Updated | 2017-01-10T22:17:33.000+0000 |
Description
*Scenario:*
Customer's want to prevent any unauthorized request. In newly developed features we can block URL by adding blacklistedURLs property. But its only helpful if we have URL list but if we don't have any predefined URL then it will not helpful.
If stopLoading() stop loading content then customer need like stop request function which is stop sending request.
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:*
var win = Ti.UI.createWindow({
backgroundColor : 'black',
layout : 'vertical'
});
var webview = Titanium.UI.createWebView({url:'https://en.m.wikipedia.org/wiki/Main_Page'});
webview.addEventListener('beforeload', function(e){
Ti.API.info("beforeload = e.url=" + e.url);
if(e.url.indexOf('wikimediafoundation.org/wiki/Terms_of_Use') > -1){
webview.stopLoading();
Ti.API.info("Inside TERMS OF USE");
} else if (e.url.indexOf('wikimediafoundation.org/wiki/Privacy_policy') > -1){
webview.stopLoading();
Ti.API.info("Inside privacy policy");
}
});
webview.addEventListener('load', function(e){
Ti.API.info("load = e.url=" + e.url);
});
win.add(webview);
win.open();
*Test steps:*
Run test code in classic project
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
File | Date | Size |
---|---|---|
Capture.PNG | 2016-05-10T10:52:43.000+0000 | 95826 |
screen_using_blacklistedurl.png | 2016-05-10T10:52:39.000+0000 | 231869 |
Just want to check, this is for iOS, correct?
[~apetkov] Once Ash and the rest determine the approach, can you work on this fix?
Had the call with client (Rajeev & Koushik) with Ash and Angel from our end and we came to the agreement that we will have the feature ready buy next Wednesday May18th
Hello, the ticket for IOS is in progress now we've had feedback off the customers, they seem to be happy with the android implementation. The iOS feature should be finished by the end of this week, I apologize for the delay as I've been out the office and we have also been waiting on feedback of the Android implementation which seems to have gone smoothly. Again the iOS feature should be out shortly (end of this week) Thank you!
Introduced onStopBlackListUrl * PR: https://github.com/appcelerator/titanium_mobile/pull/8019 * Custom Build: https://www.dropbox.com/s/v3ol1q4tddumzhs/mobilesdk-5.4.0-osx.zip?dl=0 _*Steps to Test:*_ Click the 9 or iOS library link. _*Expected Result:*_ Nothing should open and the event should be triggered with the event data loged. Demo Code:
[~morahman] Yes, my mistake I was testing the flush of the array in the demo-code and forgot to remove it before adding it to Jira. My apologizes, could you test again thank you!
[~apetkov] , [~arohini], Now it works with the updated test case. Thanks.
Thanks [~morahman] !!
[~morahman], Client reported that its still not working. Did you test it with the build from the link below? PR: https://github.com/appcelerator/titanium_mobile/pull/8019 Custom Build: https://www.dropbox.com/s/v3ol1q4tddumzhs/mobilesdk-5.4.0-osx.zip?dl=0
How about using
stopBlackListUrl
as event name instead ofonStopBlackListUrl
? IfonStopBlackListUrl
, the xml hasonOnStopBlacklistedUrl
name.onOn
dosn't look good.[~yomybaby] Hello I appreciate the feedback and agree completely that it should be called stopBlackListUrl however this ticket is just for the iOS feature. I cannot rename it within this PR as the customBuild is already being used for testing by the customers. Once this feature is merged we will create a new ticket and rename the event for both iOS and Android.
[~apetkov], Any update on the fix for this issue ?
Any news? :)
I hope that this iOS code will be merged soon. Please :) Because Android has this feature already in 5.4.0.GA.
this property for Android was included 5.4.0! Not yet on iOS. @apetkov Is there any reason? :)
[~hansknoechel] PR: https://github.com/appcelerator/titanium_mobile/pull/8732 Test code -
Verified improvement with the test case provided by [~vijaysingh] application was no longer displaying the blacklisted URL. *Environment*