-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
href click sometimes opens in new page #151
Comments
I think I have this fixed in the latest version (r159). If you still see issues, please reopen this and add a comment. Thanks! j |
Updated to r159 but the problem still exists. The ajax call on line 444 (coincidence??) gives an error if I use left-click on a href, but it gives success when I middle click (the mouse wheel click). In error I see readyState 4, status 0. If you need more information, I can try to find out. PS I am cannot find any option to re-open issues on github. Please help me to set the status to open. Edit: I also see this happening when I have a success on the ajax call, thus it is not just a matter of the ajax call |
Additional info: Upon left click I see in the error console : failed to load resource Upon middle click I see nothing wrong in the error console. It seems that the link (href="http://address:port/myresource") is loaded but upon left click jqtouch does not wait for the data to load correctly. The server supplies a html snippet with a surrounding div containing a div ID that was generated by the server. When everything goes fine, I can see (web inspector) that the html snippet is inserted in the body and that the original href link is replaced with the div ID (some kind of caching ?) It looks to me that the page transition is done before the new data is completely inserted into the DOM. |
I downloaded the jqtouch.zip from here and minimized my app to test again. I was able to catch the headers from the communication when the href is clicked: GET /myserver/doaction?section=M&start=0&num=30 HTTP/1.1 HTTP/1.1 200 OK To me this looks normal.... I will try to setup a test environment. unfortunately this issue is blocking my app as the ipod can't be tricked with a middle click |
Testcase: http://www.maakmenietgek.com/testcase151.html Source of testcase: http://www.maakmenietgek.com/testcase151.zip The transition the page linked to in the href fails in Safari and Chrome when using left click, but succeeds when using middle click. |
If I download jqtouch from the www.jqtouch.com website (version 1 beta 2) or r109, then it simply works fine with the normal left click. |
I have traced the problem back to the "last good" and "first failing" jqtouch files. As the problem starts to occur between checkins on one day with the same revision number, I am posting the comment line here. Please note that the date April 24 in the header must be very wrong if it is checked in on October 19 From the jQTouch history in GitHub, on October 19, 2010: Last good working version (for this issue) Comment that was used at checkin Added check to set body id to jqt if no jqt element is found
First version that incorrectly opens href links Comment that was used at checkin Minor refactoring. Note that checkboxes, radiobuttons, and form submission are all screwed up - working on that next.
Now I am tracing which exact line causes the problem. Once isolated I will feedback here |
My link from the testcase (I added spaces to make show the full tag <a href="http://www.maakmenietgek.com/tc_issue151.html"><span style="vertical-align: middle;">Open test page</span></a> Note the span inside the anchor tag. This causes the click handler to fail to execute the e.preventDefault. function clickHandler(e) { _debug(); // Prevent the default click behavior if (e.target.nodeName === 'A') { <<<< nodeName === SPAN e.preventDefault(); } // Convert the click to a tap $(e.target).trigger('tap'); } This e.preventDefault has been added between the two revisions that I mentioned earlier. However I do not know why it has been added but it breaks the usage of tags within the anchor tag. Tracing this to the latest revision:
Gives me the same kind of problem here if ($el.attr('href')) { if (!$el.isExternalLink()) { // Checks for mailto, maps, tel, checkboxes, etc... e.preventDefault(); _debug('Preventing default click behavior'); } }; $el.attr('href') shows as 'undefined'. I assume that this is caused because of the span tag as well. Can you please open this issue again as bug, or should I open a new issue for this ? |
Hi there, I can confirm I am getting the same issue, if I put any tags inside an a tag with a href I get a new page loaded and not the animated slide. For example:
If I click the plain text the default click behaviour works, if I click the image or any other tag then it breaks and goes to a new page. Anyone got any ideas how to resolve this? Cheers, Josh |
Hi everybody - Thanks for all the info. Working on a fix. Stay tuned - j |
Hi all I would just like to report this seems to be fixed in the latest revision: Cheers, Josh |
Excellent! Thanks so much for the update. - j |
Hi,
I have some links <a href="http://...." > tags inside <div> <ul> <li>, and they appear as 'buttons' (jqt theme) on my main page. When I click the link it will get data from the webserver which is a formatted html <div> with content.
jQTouch 1.4.2 Revision 150
Safari 5.0.2 (7533.18.5)
Mobile Safari iPod Touch 3.1.3
edit: I found that whenever I left click on the href, a new page opens in the same window, when I middle click the mouse, the page opens correctly (sliding to the correct div).
edit2: Tested again with jquery 1.3.2 and that one works. Note that I use <div id="jqt"> with 1.4.2 but not with 1.3.2. When switching the version I also switch the extensions and themes.
The text was updated successfully, but these errors were encountered: