Titanium Community Questions & Answer Archive

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

Can't click links inside a webview

I am creating a way to present news article from an RSS feed. Because the content that is returned is html and because the content can change, I simply create a webview and add it to a row. Everything works fine, the styling shows properly, however, when I try to click a link within the content of the article, nothing happens. I tried changing the zIndex to no avail.

Any suggestions/solutions would be appreciated.

— asked July 21st 2010 by Abraham Vivas
  • html
  • links
  • webview
0 Comments

4 Answers

  • If the link on the content is just another link to other web page, it should work just fine, unless you registered event handler to the webview such click or touch, that would overwrite link on your webview.

    — answered July 21st 2010 by Daniel Lim
    permalink
    5 Comments
    • The problem is that the link doesn't even highlight, almost as if I never tapped on the link. I have no event handlers on the webview either, so I don't know how to fix this.

      — commented July 21st 2010 by Abraham Vivas
    • Could be a blank url. A simple test is set your webview url to google.com instead of your content.

      — commented July 21st 2010 by Daniel Lim
    • Already tried that…it simply doesn't open the links. the html looks like this

      var webviewHTML='<html><body style="padding:0;font-family: Helvetica;font-weight:normal;font-size:13px;"><a href="www.google.com">Click Me</a</body></html>';
      

      and then I set webview.html=webviewHTML and I still get nothing.

      As I mentioned above, the link doesn't highlight, and if I hold the options tab (open link, copy, cancel) does not come up either.

      — commented July 21st 2010 by Abraham Vivas
    • You're missing the close braket
      <a href="www.google.com">Click Me</a

      You should try it with setting your webview.url = google.com, the link from google should work

      — commented July 21st 2010 by Daniel Lim
    • Tried that, and the google homepage is displayed but I can't click on any link, or search anything. I have tried to change the tuochEnabled settings as well, but nothing seems to work.

      — commented July 21st 2010 by Abraham Vivas
  • post ya code

    — answered July 21st 2010 by Daniel Lim
    permalink
    1 Comment
    • I posted the code

      — commented July 21st 2010 by Abraham Vivas
  • The code is available here

    — answered July 21st 2010 by Abraham Vivas
    permalink
    3 Comments
    • You created webview on tablerow, i don't think that's the way it works or you want that to work. Your row should be the article title and when you click on it, it then create webview with link from the article.

      For instance
      tableview.addEventListener('click',function(e){
      create window, and webview
      })

      Have a look at KS xml_rss.js

      — commented July 21st 2010 by Daniel Lim
    • Well this is a new page that I create after getting the titles, once they click on the title I want them to go into a page that looks like this.

      The second row is the webview which has the html content. Because it has links I want to display it on a webview in the row so that click can be accessed in there as well.

      — commented July 21st 2010 by Abraham Vivas
    • If you have rows with different outcomes on click, you can detect the row index on create to open webview or page.

      tableview.addEventListener('click',function(e){
      
      if(e.index==0){
      create window with page
      }
      else{
      create window with webview
      }
      })
      

      tableview has many row properties you can use, index is just one of them

      — commented July 21st 2010 by Daniel Lim
  • Anyone ever get an answer on this? Is it just impossible?

    — answered September 7th 2010 by Ben Strackany
    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.