Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25434] iOS: WebView beforeload event fires multiple times before and after the load event.

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionInvalid
Resolution Date2018-12-05T18:39:24.000+0000
Affected Version/sRelease 6.2.2
Fix Version/sn/a
ComponentsiOS
LabelsIngelby
ReporterJebun Naher
AssigneeJoshua Quick
Created2017-10-24T10:51:02.000+0000
Updated2018-12-05T18:39:24.000+0000

Description

*Problem Description:* When I try to load a webpage in a WebView, it shows that WebView "beforeload" event runs multiple times before and after the "load" event. *Steps to reproduce:* 1. Run below code using latest SDK 6.2.2GA 2. Observe the console log and you'll see beforeload event is fired multiple time after the "load" event *Expected:* The beforeload event should fire once before the load event. *Actual:* Beforeload event fired multiple times before and after the load event. *Test Code:*
var window = Ti.UI.createWindow();

var webview = Titanium.UI.createWebView({url:'https://www.amazon.com'});

webview.addEventListener("beforeload",function(){
Ti.API.info("beforeload");
});
webview.addEventListener("load",function(){
Ti.API.info("load");
});
window.add(webview);
window.open();
Test Output:
[DEBUG] :  New scheme: <NSMutableURLRequest: 0x1c4019030> { URL: https://www.amazon.com/ }
[INFO] :   beforeload
[DEBUG] :  New scheme: <NSMutableURLRequest: 0x1c0019990> { URL: https://images-na.ssl-images-amazon.com/images/G/01/ape/sf/mobile/msf-1.10_FX4._V514589606_.html }
[INFO] :   beforeload
[INFO] :   load
[DEBUG] :  New scheme: <NSMutableURLRequest: 0x1c401d1b0> { URL: https://s.amazon-adsystem.com/iu3?d=amazon.com&slot=navFooter&a2=010193484d71b6d1d6b622051893e17806712cacda5c462b0f43438756061e082c50&old_oo=0&cb=1508839252767 }
[INFO] :   beforeload
[DEBUG] :  New scheme: <NSURLRequest: 0x1c0019b40> { URL: https://s.amazon-adsystem.com/iu3?d=amazon.com&slot=navFooter&a2=010193484d71b6d1d6b622051893e17806712cacda5c462b0f43438756061e082c50&old_oo=0&cb=1508839252767&dcc=t }
[INFO] :   beforeload
[DEBUG] :  New scheme: <NSMutableURLRequest: 0x1c02000b0> { URL: https://s.amazon-adsystem.com/v3/pr?ex-rc=ySTN_IHHQdCKB5jmd4L7-A&exlist=pp_sx_g_bsw_kr_ox_index_aold_an_fbca_aolv_twca_pm_adelphic_adb&fv=1.0&ex-pl-fbca=nEwlkpBFRZumYAgukLnB3Q&ex-pl-twca=vzOkuiYkSG6oB6VtvYR53A&a=cm&ep=9ufXSFDrukx-dtPrWJKOAJA_WyuMPClc60LpokuFPRD1xLWskFT-BQFX7l61Cq39 }
[INFO] :   beforeload

Comments

  1. Hans Knöchel 2017-10-24

    It looks valid to me, because it loads multiple resources inside the web-view as seen in the logs. If you compare the loaded links in the console, they are all different and likely part of a web-page. This is the intended behavior.

JSON Source