Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13057] iOS: WebView: beforeload event fires twice (local file path)

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2013-03-19T23:03:41.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 06 Core, 2013 Sprint 06
ComponentsiOS
LabelsSupportTeam
ReporterEduardo Gomez
AssigneeMax Stepanov
Created2013-03-14T00:58:07.000+0000
Updated2017-03-28T22:51:51.000+0000

Description

Issue

When app bring up the webview on iOS, we can see one beforeload and one load event. After calling webview.reload(), it can be seen 2 beforeload and load events.

Steps to reproduce are as follows:

1. start app 2. notice 1x beforeload and 1x load events 3. tap [reload] button 4. notice 2x beforeload and 2x load events

load

[INFO] app.js: webview.beforeload: uuid: na, url: file:///Users/gary.fong/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/64CBE284-753E-47FC-BA3A-ED78C03BF2A2/AndroidWebViewReload2.app/test.html
[INFO] test.html: window.load
[INFO] test.html: dump: uuid: na, isReady: false
[INFO] app.js: webview.load: uuid: na, url: file:///Users/gary.fong/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/64CBE284-753E-47FC-BA3A-ED78C03BF2A2/AndroidWebViewReload2.app/test.html

reload

[INFO] app.js: resetting url
[INFO] reloading...
[INFO] app.js: webview.beforeload: uuid: na, url: file:///Users/gary.fong/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/64CBE284-753E-47FC-BA3A-ED78C03BF2A2/AndroidWebViewReload2.app/test.html
[INFO] app.js: webview.beforeload: uuid: na, url: file:///Users/gary.fong/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/64CBE284-753E-47FC-BA3A-ED78C03BF2A2/AndroidWebViewReload2.app/test.html
[INFO] test.html: window.load
[INFO] test.html: dump: uuid: na, isReady: false
[INFO] app.js: webview.load: uuid: na, url: file:///Users/gary.fong/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/64CBE284-753E-47FC-BA3A-ED78C03BF2A2/AndroidWebViewReload2.app/test.html

Attachments

FileDateSize
app.js2013-03-14T00:58:07.000+00001257
test.html2013-03-14T00:58:07.000+0000731

Comments

  1. Eduardo Gomez 2013-03-14

  2. Max Stepanov 2013-03-19

    Provided example sets url and then calls reload(). Both generate 'beforeload' events.
  3. Chunsheng Zhang 2014-02-15

    Why this bug still exists?
  4. Ingo Muschenetz 2014-02-15

    [~yiluxiangbei] You may find you get better support on a free, open-source product if you remain professional. One of the bugs you commented on was invalid, the other is still open, but does not have many watchers. What is the exact problem you are experiencing? Do you have sample test code?
  5. Chunsheng Zhang 2014-02-16

    hello,@Ingo Muschenetz.I'm sorry about the word.I use both method setUrl and reload.They triggered twice beforeload and once load.I use beforeload event to show activityIndicator and load event to get data from database.The code like this: Now I'm only use setUrl no reload method.It can work well.I sugguest you to describe it on the docs. webview.addEventListener('beforeload', function(e) { logger.info("beforeload"); activityIndicator.show(); }); webview.addEventListener('load', function(e) { //change content webUtil = require('utils/webUtil'); var beginDate = new Date(); logger.info("---------------getContent start:" + beginDate.getTime()); content = webUtil.getContent(this); logger.info(content); var endDate = new Date(); logger.info("---------------getContent end:" + endDate.getTime() + " use time:" + (endDate.getTime() - beginDate.getTime())); var date = new Date(); Ti.App.fireEvent('app:changeContent', { time: date.getTime(), type: this.menu.type, code: this.menu.code, pageId: this.menu.pageId, newsId: this.menu.newsId, content: content }); logger.info("load"); activityIndicator.hide(); });
  6. Eduardo Gomez 2014-02-16

  7. Lee Morris 2017-03-28

    Closing ticket as invalid.

JSON Source