PDA

View Full Version : a href in html text not clickable



gerartje
8 Jul 2010, 2:10 PM
Hello,

anyone a solution for the fact that you can't click or tap on a href links in html text.
Or is it just me :-)

Thanks

evant
8 Jul 2010, 7:22 PM
Just you I think...

For example I changed the toolbar example:



new Ext.Panel({
id: 'toolbartxt',
html: '<a href="http://sencha.com">Sencha!</a>',
fullscreen: true,
dockedItems: dockedItems
});


I can click on the link as per usual and it redirects me.

smr
12 Jul 2010, 5:07 AM
I've got exactly the same problem, but when I'm putting data into a template and then trying to access on Android device - works fine if I access via my desktop. My code is:



var panel = new Ext.Component({
title: 'Links',
cls: 'timeline',
scroll: 'vertical',
tpl: [
'<tpl for=".">',
'<p><a href="{url}">{linkText}</a> - {title}</p><p>&nbsp</p>',
'</tpl>'
]
});

TommyMaintz
13 Jul 2010, 1:27 PM
I think this is because TouchEventManager calls preventDefault on the touchend event. We will look into this and get back with a reply to this thread asap.

grantatwbx
14 Jul 2010, 1:05 PM
I think I ran into the same issue here. my anchor tags were not "clickable" in Android... I used this as a work-around and it seems to work:


myAnchorEl.on('tap', function() {// open a link})

TommyMaintz
14 Jul 2010, 1:06 PM
Yeah, that will work.

To catch all anchors inside a panel you could use event delegation.



panel.body.on('tap', function(e, t) {
document.location.href = t.href;
}, null, {delegate: 'a'});

smr
23 Jul 2010, 7:19 AM
I've still got this problem - and am obviously being daft since when I call panel.body.on(...), it seems that body is undefined. Also, I've got panels nested within panels, and its not obvious which level I need to place the delegation code in, or if I have to place it in all of them.

This is Android specific - it works fine on my desktop and on an iPad.

toe
7 Sep 2010, 1:57 PM
I have had this same issue. I have had to use


document.location = "http://yahoo.com";


When creating an app this is as useful but not if you want to make a phone call. The Android does not recognize phone numbers in document.location. So this is only good if you are making a mobile site. If you are trying make an Android app you will have to leave Sencha and use flat HTML. The Android browser is very inferior to the iPhone browser in app and out of app. I am not sure that there is a framework that can overcome the Android bowser.

Hope this helps.

teox76
5 Oct 2010, 3:14 PM
I think I ran into the same issue here. my anchor tags were not "clickable" in Android... I used this as a work-around and it seems to work:


myAnchorEl.on('tap', function() {// open a link})


Same issue here! could someone please lend me a hand? I'm not able to implement the quoted workaround :-( My panel is the following



var mypanel = new Ext.Panel({
html: '<div><a id="mylink" href="page.html"><img src="img/logo.png"/></a></div>',
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
title: 'Title...',
height: 35
}],
cls: 'advertisment',
id:'adv'
});


what should I use instead of "myAnchorEl" in my example ? I have tried the panel object, id, etc but with no success :-(
Thank you for any answer, I hope this will be fixed soon !

teox76
6 Oct 2010, 12:39 AM
I have also tried this solution, but It tells me that "body" is undefined :-(


Yeah, that will work.

To catch all anchors inside a panel you could use event delegation.



panel.body.on('tap', function(e, t) {
document.location.href = t.href;
}, null, {delegate: 'a'});

joseeight
13 Oct 2010, 11:01 AM
I had this problem in which I has an anchor tag that has an onclick event:


<a href="#" onclick="someFunction()">My Link</a>

I tried the code from above making all body anchor tags work, which it worked well, but then also caused the page to scroll to top on Android causing a bounce effect. I then also tried going into the ext-touch.js file and removing the "preventDefault" method, which also worked, but still same problem. Finally I got around to removing the "href" anchor tag attribute and just leaving the "onclick" one. This worked and nothing had to be done, meaning you don't have to implement any hacks/fixes, just not include the "href" attribute in the anchor tag if you plan on having the tag call a method.


<a onclick="someFunction()">My Link</a>

Hope this helps anyone that runs into this problem.

TK421
23 Oct 2010, 6:27 PM
I ran into the same problem. I'm going to try removing the hrefs to see if it fixes it.

MiamiCoder
25 Oct 2010, 11:54 AM
I have the same problem. Wondering if I should wait for a fix, as this is not critical for my app yet, or implement workaround.

joseeight
27 Oct 2010, 5:29 AM
The workout I posted doesn't work in 0.97, I started a new thread here:

http://www.sencha.com/forum/showthread.php?112752-Anchor-lt-a-gt-tags-not-working-on-Android-(0.97)