In my Sencha Touch 2 application I need to handle redirection events on my own. By this I mean I need to be able to handle a href events and do the redirection myself.
I'm using the following code:
Ext.Viewport.element.addListener("tap", function(e) {
e.stopEvent();
e.stopPropagation();
e.preventDefault();
var href = e.target.getAttribute("href");
// ... my code ...
}, this, {delegate: "a"});
By none of the above mentioned functions work (stopEvent
, stopPropagation
, preventDefault
). The application always opens the link in my app web view.
Is here any possible way to disable a href opening links?
I usually do this this way :
Ext.Viewport.element.dom.addEventListener('click', function (e) {
if (e.target.tagName !== 'A') {
return;
};
e.preventDefault();
var href = e.target.getAttribute('href');
}, false);
Try here
Hope this helped
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With