Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

webview.url not updating when webview changes... Heck.

I have a webview in an iPad app that lets user browse the web. But, the url property isn't populating with internally linked pages.

    var string = html.match(/<TITLE[^>]*>[^<]*<\/TITLE[^>]*>/i).toString();
    string = string.replace(/<[^>]*>/g,'');
    return string;
}
var win1 = Titanium.UI.createWindow({  
    backgroundColor:'#000'
});

var webview = Ti.UI.createWebView({
    left:0,
    right:0,
    top:40, 
    bottom:400, 
    borderColor:'#333',
    borderWidth:'.5',
    loading: true,
    url:'http://google.com'
});
var titlebutton = Titanium.UI.createButton({
    title: 'Title & URL',
    top:10,
    left:10,
    height:20,
    width:120,
    borderWidth:0,
    font:{fontSize:11,fontFamily:'HelveticaNeue-Bold'}
});

titlebutton.addEventListener('click',function(e){
    alert(gettitle(webview.html) + '\n' + webview.url + '/');
    }
);
win1.add(titlebutton);
win1.add(webview);
win1.open();

If you click on any link and then click on the "Title & URL" Button, it should show the title and the current url. But, the url isn't the url of any internally linked pages that I click on. Heck.

What am I missing?

— asked June 24th 2010 by John-Michael Keyes
  • ipad
  • url
  • webview
1 Comment
  • did you ever find an answer to this? I'm facing the same problem…

    — commented September 27th 2010 by david hoare

1 Answer

  • Hi,
    answer is here :) http://developer.appcelerator.com/question/76131/the-url-propierty-of-a-webview-didnt-change I guess.

    — answered November 16th 2010 by JeanSebastien GALLOO
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.