Sencha Touch 2 - prevent a-href events (handling a-href events)

in my Sencha Touch 2 app, I need to handle the redirect events myself. By this, I mean that I need to be able to handle href events and redirect myself.

I am 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"}); 

None of the above functions work (stopEvent, stopPropagatioon, preventDefault). An application always opens a link in my web view of the application.

Is there any possible way to disable href opening links?

+6
source share
1 answer

I usually do this:

 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 helps

+12
source

All Articles