Titanium Community Questions & Answer Archive

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

Changing a URL in a Object

Hello Guru's,

I've been pushing myself to learn javascript and I'm ever so slowly gaining some insight in this strange beast. I'm currently attempting to figure out how to change a url that I've loaded into a object that I parsed from an xml file.

I'm using the kitchen sink example here,

row.url = item.getElementsByTagName("link").item(0).text;

I can correctly assume that when my xml document is parsed, anything in the <link> </link> will be saved to "link".

My xml is generating http://www.website.com/forum/thread000000/pg1 links. I would like to change my www. to m. (mobile version) to load in my created "webview" when the row is selected

I do feel it would be easier to just generate a new xml file that's a pointer solely for the mobile enviroment, HOWEVER, I would like this problem solved so I can add it to my knowledge.

Thank you in advance for taking a look at my question.

— asked October 12th 2010 by Joe Irvine
  • parsing
  • url
  • webview
  • xml

1 Answer

  • If i where you, i would have done the following:

    download this function:

    Then use the following code:

    var url = "http://www.website.com/forum/thread000000/pg1";
    var url2 = "http://m"+substr(url, 10);
    — answered October 13th 2010 by Peter Griffin
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.