beedesk / jQTouch

jQT + actively maintained + exclusive features (iPad layout, iscroll, tons of css enhancements, page events, param passing between pages, radio button, grid, mail, improved page history management etc.)
http://bit.ly/beedesk-jqt
MIT License
72 stars 13 forks source link

Cannot open new browser page programmaticaly on iPhone #22

Closed l0c0luke closed 12 years ago

l0c0luke commented 13 years ago

I have "link" elements. A "link" may be an external link. When I click/tap a "link" the binded function checks to see if an external link, if so, then it calls an external link function that does a little logic to decide if I open up a phonegap plugin to display browser or just open up a new tab with

window.open(url, '_blank');

Now this did work once upon a time but it does not work now. Everything works fine except for the window.open which appears to do nothing. I have dabbled with changing the name attribute in that function call to no avail.

It works fine in Google Chrome and even on Desktop Safari. It is only when trying on my iPhone or simulator nothing happens.

Interestingly, I thought I had this fixed recently by changing my binded "link" function to activate on "tap" and not "click". Initially I had thought this was not needed as you do the smarts behind the scenes to compensate for this but I tried it on a whim and it worked. I have since updated to your latest and greatest commits involving the spinningwheel and "tap" no longer does anything.

l0c0luke commented 13 years ago

I had also read that maybe I am becoming a popup generator by calling function after function and then doing the window open. Well I tried the window.open right away and still to no avail. I see that the activity indicator spins briefly, but nothing.

thomasyip commented 13 years ago

Luke, thanks for the bug report.

Look like my attempt to fix the double-open problem causes problem to custom handler. Without phonegap, in fullscreen mode, the only way to open a webpage externally is to let the Safari's default handler to handle the click event.

I need to try phonegap myself to find a solution for this case. In the mean time, you probably can get away with reverting the following line.

Let me know if it works or not.

https://github.com/beedesk/jQTouch/commit/4c747e30823acebcec48575c9eb2a1e8603d6b33 ====== jqtouch.js line 1117

l0c0luke commented 13 years ago

Reverting that line does not fix.

Let me clarify something just to be sure we are testing right thing ... Althrough I do have Phonegap logic going on in this function, it never actually gets used. This problem only exists when I open up my Safari on the phone and navigate to the URL. Phonegap does not exist at this point so not sure if you need to dive into that yet.

thomasyip commented 13 years ago

Alright, please revert the whole patch. (reverting the line wont work)

I will try to figure what happen tonight (PST time). But, it should be the only patch in the related area lately. Let me know if t work or not.

Sent from my iPhone

On Apr 25, 2011, at 8:50 AM, l0c0lukereply@reply.github.com wrote:

Reverting that line does not fix.

Let me clarify something just to be sure we are testing right thing ... Althrough I do have Phonegap logic going on in this function, it never actually gets used. This problem only exists when I open up my Safari on the phone and navigate to the URL. Phonegap does not exist at this point so not sure if you need to dive into that yet.

Reply to this email directly or view it on GitHub: https://github.com/beedesk/jQTouch/issues/22#comment_1053372

l0c0luke commented 13 years ago

Tried reverting just the changes in that commit with no luck. I did not however, revert my entire jQT back to that commit... yet.

thomasyip commented 13 years ago

Will surely take a look tonight.

One more thing you could help me on. Can you try the main demo on your iPad to see if it external link is working (and otherwise generally working)? If you see anything broke there, I am sure it would be an easy fix. (finding a reprod is usually the harder half of a solution.)

l0c0luke commented 13 years ago

I do not have an iPad but using the simulator on the ipad in safari my ap external link was not working... but your Twitter external link did work from your main demo.

thomasyip commented 13 years ago

I did refresh the example and tried it on a real iPad, it worked. I also have an app that call window.open(), and it is surely working.

You already aware, window.open() must be called within another click, tap or mouseup events. I know that tap event would able trigger window.open().

Can you confirm your code will run with older version of the fork? Or, Is it something you can share privately that I can debug into it.

thomasyip commented 12 years ago

I added '.nofasttouch' to . If the class is specified, jqtouch will avoid handling the click, making it possible to fall back to default click behaviour.

I still don't have a chance to do a full debug session, but I hope it let you workaround your problem. Let me know how it goes.

l0c0luke commented 12 years ago

ultimately i had to rewrite my logic to not use so many function redirects and go straight to the link. It works good using your latest commit. i would say close this.