Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14897] Android: WebView reload method doesn't clear browser history

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionWon't Fix
Resolution Date2013-08-26T17:24:45.000+0000
Affected Version/sRelease 3.1.1
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, ios
ReporterCésar Cavazos
AssigneeIngo Muschenetz
Created2013-08-16T18:18:22.000+0000
Updated2017-03-22T17:50:58.000+0000

Description

According to our docs the reload method clears the browser history but this is not working on Android nor iOS http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.UI.WebView-method-reload Sample app:
var win = Ti.UI.createWindow({
	height: Ti.UI.FILL,
	width: Ti.UI.FILL,
	backgroundColor: "#FFF",
	exitOnClose: true,
	fullscreen: false,
	title: 'WebView Test'
});

var webView = Ti.UI.createWebView({
  top: 160,
	left: 0,
	right: 0,
	bottom: 0,
	url: 'http://www.google.com'
});

webView.addEventListener('load', function(_evt){
  console.log('Load triggered');
});
webView.addEventListener('beforeload', function(_evt){
  console.log('beforeload triggered');
});
webView.addEventListener('error', function(_evt){
  console.log('error triggered');
});

var button1 = Ti.UI.createButton({
  title: 'Back',
	width: 100,
	height: 50,
	top: 20,
	left: 10
});

var button2 = Ti.UI.createButton({
  title: 'Forward',
  width: 100,
  height: 50,
  top: 20,
  right: 10
});

var button3 = Ti.UI.createButton({
  title: 'Reload',
  width: 100,
  height: 50,
  top: 90,
  left: 10
});

var button4 = Ti.UI.createButton({
  title: 'Change URL',
  width: 100,
  height: 50,
  top: 90,
  right: 10
});

button1.addEventListener('singletap', function(_evt){
  console.log('------------- back');
  if (webView.canGoBack()){
    webView.goBack();
  }else{
    console.log('WebView can\'t go back');
  }
});

button2.addEventListener('singletap', function(_evt){
  console.log('------------- url = tap');
  if (webView.canGoForward()){
    webView.goForward();
  }else{
    console.log('WebView can\'t go forward');
  }
});

button3.addEventListener('singletap', function(_evt){
  console.log('------------- reload');
  webView.reload();
});

button4.addEventListener('singletap', function(_evt){
  webView.url = "http://appcelerator.com";
});

win.add(button1);
win.add(button2);
win.add(button3);
win.add(button4);
win.add(webView);
win.open();

Steps: 1. Run the app. 2. Tap change url (You will be redirect to appcelerator.com) 3. Tap reload 4. Tap back

Comments

  1. Ingo Muschenetz 2013-08-26

    On iOS, we can't fix this as the workaround is likely to result in app rejection from the App Store. Moving to mark this as "won't fix" and create a separate documentation bug to clarify the documentation issues involved.
  2. Lee Morris 2017-03-22

    Closing ticket as the issue will not fix and with reference to the above comments.

JSON Source