-
Notifications
You must be signed in to change notification settings - Fork 20
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
What am I doing wrong? #6
Comments
Frank, The question here is whether the links you are using contain absolute urls or not. Under the original version of the script, all absolute urls will open in safari. If you want to keep them there, check out my modified plugin at https://github.com/techdude/jQuery.stayInWebApp. I issued a pull request and mrmoses said that it would be incorporated into the main project but it hasn't yet. The main thing is the addition of the way to keep absolute urls in the webapp. Use should be similar to this:
Another thing to check if it is not working is to ensure that you are not putting this inside of some other document ready function. It should be on the first scope level, or you should omit the first and last lines. Hope that helps, |
Frank,
Or if you are putting it inside of your own document ready function, use this:
Of course, it must be inside of a document ready function because the links must exist in the DOM before they can be modified. Also, this is using the update script available at https://github.com/techdude/jQuery.stayInWebApp, not the original mrmoses script. Hope this helps you even more, |
Techdude, Thanks for your help but I must be a complete numbnuts... It's still not working... Frank |
I think I got some kind of jquery conflict in the page. When I use the exact same code in one of my wordpress pages it works like a charm. F. |
What other scripts are you using? Try replacing the $ with jQuery. This might work for some conflicts. Also, check for script errors in the page when you run in on your computer (use safari inspector). ~techdude |
Ok, I looked at your source code and you are doing this:
Instead you should do this:
The first option won't run because you are setting the document ready functionality inside of a document ready loop so the event never fires a second time. Remember, ~techdude |
Thanks again. F. |
You definitely have a conflict. Use jQuery.stayInWebApp(options); instead of $.stayInWebApp(options);. You need to use jQuery everywhere you use $ because something else on the page is using the $ variable. ~techdude |
jQuery conflict solved and working as expected! Thanks for your help Techdude! Frank |
Frank, Glad to hear it is working. I'm pleased I could help. ~techdude |
Hi,
I just can't get it to work... Done all I should've done but it still opens Safari.
I changed the if statement to this: if($(this).attr("target") != "_blank") so all links except _blank should stay in the web app...
This is the page I'm working on www.pi-gaomovement.com.
Any help would be highly appreciated.
Thanks,
Frank
The text was updated successfully, but these errors were encountered: