Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7849] iOS: TiUIWebView beforeload event doesn't have the URL

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-03-06T11:30:27.000+0000
Affected Version/sRelease 1.8.2
Fix Version/sSprint 2012-05, Release 2.0.0
ComponentsiOS
Labelsmodule_webview, qe-testadded
ReporterTaracque
AssigneeStephen Tramer
Created2012-02-29T03:36:58.000+0000
Updated2013-11-25T08:50:59.000+0000

Description

When beforeload event called in TiUIWebView.m the URL is unknown. The beforeload event should be moved to shouldStartLoadWithRequest, to let beforeload know what url will be opened. A suggested fix can be found here: https://github.com/appcelerator/titanium_mobile/pull/538

Comments

  1. Taracque 2012-03-01

    I don't think it's a New feature. As the documentation clearly describes, that the URL is passed on beforeload event, I still think this is a bug. http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.WebView.beforeload-event.html
  2. Marshall Culpepper 2012-03-02

    This issue is simply pending functional review on Taracque's existing PR here: https://github.com/appcelerator/titanium_mobile/pull/538
  3. Taracque 2012-03-06

    You can test this issue with this code: var webViewer = Titanium.UI.createWebView({ top:0, left:0, width:'100%', height:'100%' }); webViewer.addEventListener('beforeload',function(e){ alert("BEFORELOAD: " + e.url); }); webViewer.addEventListener('load', function(e){ alert("LOAD: " + e.url); }); var winFront = Titanium.UI.createWindow({ title:'TUiWebView', navBarHidden: true, backgroundColor:'#d6d6d6' }); winFront.add(webViewer); winFront.open(); webViewer.url="http://www.appcelerator.com/"; You will see, that beforeload alerts are displays the current url every time (which always can be read from webViewer.url property) , and load alert displays the new url. If you accept my patch, beforload handler can reject page before it actually loads depending on URL. The current implementation has no sense.
  4. Michael Pettiford 2012-03-07

    Closing issue Tested with Ti Studio build 1.0.9.201202141208 Ti Mob SDK 2.0.0.v20120307090205 OSX Lion 10.7.3 iPhone 4S OS 5.0 Expected behavior is shown
  5. jithinpv 2013-11-25

    Anvil test case added. PR link: https://github.com/appcelerator/titanium_mobile/pull/5020

JSON Source