Links in remote JQueryMobile sites in a PhoneGap app open safari - ios

I'm having quite a peculiar problem with PhoneGap and JQuery Mobile, using the latest versions of both frameworks as of this writing.
My phonegap app has some pages 'local' to the app, and other pages that are loaded directly from a remote site. Going between the local and remote pages is fine (there is no transition but that can't exactly be helped). However, once I'm on the remote pages, any link I click on the remote pages opens Safari with the page I requested. This is not desirable functionality, as I would like it all to be within the UIWebView, and none of my links are marked with anything special that would cause Safari to open.
It gets weirder. If I then switch from Safari back to the program, the remote page I requested appears in the UIWebView, however pressing the back button leads me not to the first remote page, but the first local page.
The phonegap app right now is quite bare, very close to the default except with JQM css + js loaded. This happens even if I create a simple test app that has one local JQM page, one remote JQM page and then a remote page that is linked to from a JQM remote page.
I'm stumped. What's going on here?

The default behavior for PhoneGap is to open external links in Safari unless they are added to the ExternalHosts property in PhoneGap.plist.
Try adding the external hosts and PhoneGap should behave correctly and load the external locations inside of the application.
(source: tumblr.com)
Here also is a post about using iFrames and ExternalHosts that could be of some help as well.

Related

iOS web app opens Safari in spite of avoiding HTML 'href' links

My IOS (tested on 9.2) web application (apple-mobile-web-app-capable) avoids <a href="xxx" />
links and uses only Javascript navigation functions like windows.location.replace(url) to navigate to the pages.
The root of my application is not www.xxx.com but www.xxx.com/mysite. Some of the navigate operations to /mysite/xxx are working, but other navigations to /mysite/yyy open the Safari window.
Beside the <a href="xxx" /> links, are there other situations which can cause the web app to open the link in a separate Safari window ?
I do not use target Attribute. All my links look like
<a ng-click="vm.replace('/mysite/xxx') class="navbar-brand">Contact</a>
...
replace(url:string) {
this.$window.location.replace(url);
}
I also tried the different variations (location.href = url, location = url) all with same result. Maybe the Problem is IOS 9.2 related, I am sure that the same construct was working in web apps I created some month ago.
Is it possible that the content of the target page is responsible for this behavior ? Navigating from /mysite/Home to to /mysite/Media works, navigating to /mysite/EPG opens the Safari browser. Maybe something bad in the browser cache ? So I cleared the cache, but same result.
Based on your description, it sounds like target="_blank" is being used, which is what causes web links to open in a new window. As you're using JavaScript for all your links, this should be relatively easy to check.

Titanium webview iframe doesnt seem to store cookies

I am developing an app using Appcelerators Titanium. The app consists of a webview. The webview shows i local page, iframe.html, and this iframe's src is pointed to a remote page.
However, this doesn't work out as i expected since it doesn't seem like the remote page can't store cookies when wrapped in an iframe. It works great on desktop and other devices. This seems to be an issue exclusive to iOS. I need the iframe, and i need cookies. What can i do to solve this?

Site won't open in Facebook App for ios, nor redirect to Safari

I'm not a heavy coder here, so i'll ask my best.
We made a brochure about our home town. However users spreading it trough facebook cant open the links when in their facebook app. The app does not send it to safari either. If opened directly from safari it is no problem.
The link is http://visit.lodingen360.com
Is there anything i can do to the site/index.html/whatever that will make it open in safari when the link is clicked in the facebook app for ios? (that won't affect visiting the site from pc's and so on)
Is there anything uiwebview won't read that can force it to safari, so that we can redirect from the thing opened in safari to the site?
Your page will load and display in Mobile Safari, I tried with UIWebView and it will load without displaying an error, but the brouchure page content won't display.
Safari and UIWebView have different user agent's - therefore my guess is that because your site uses flash but it checking for the type of browser you are not performing the check correctly for UIWebView and the page is attempting to use flash which isn't supported.

firebug error - what does this mean?

I'm using the jquerymobile platform with one of my Drupal sites. It works flawlessly on my dev server, but on the live server, every time I click on a link it sticks a pound sign in and refuses to load the content of the page being linked. When I hit the browser's refresh button, the pound sign goes away, and the content does load.
Example:
Sponsors
should go to http://mysite.com/sponsors. What happens on my live site is http://mysite.com/#/sponsors. The page stalls there, but if I click reload, the # goes away and the content loads.
I have a user agent switcher in firefox, so I turned firebug on, and on the live site, I'm getting the following error every time I click a link:
"attempt to run compile-and-go script on a cleared scope"
This does not occur on the dev site. The live site is http://m.shoppersummit.com/. Any ideas why this would happen? As far as I can tell, I have the same version of jquery, jqueryui, and jquerymobile installed.
Edited to address redirect loop
I've been at work since 6:30 AM; my brain is fried. This is a drupal site, with a "real" theme and a mobile theme. The only way to view the mobile theme (which is where the error is occurring) in a desktop browser is to change your user agent string to a mobile one. There's a firefox addon that will do this. If you try to view the site with a standard desktop user agent string, you will get the redirect.
Have you tried including a target? e.g. target="_self"

How to add a link to start a file download in a Rails Facebook canvas app

In our Rails app that runs in Facebook canvas, we have a workflow where a logged in user can build a document and then download it.
When the file is ready we show a link to it. This is just a Rails action that renders using send_file in dev or head (with proper NGINX config) in production. This part works fine.
In order to have the file start downloading without opening a new browser tab, we had the link target an empty iframe.
This was working, but a while back, presumably due to a security change by Facebook, our link stopped working. The JavaScript errors show:
Refused to display document because display forbidden by X-Frame-Options.
Users can still open the link in a new tab and it will download the file and a quick fix is to make the link open a new browser tab, but that isn't as good of a user experience.
We tried changing the X-Frame-Options in the headers and/or using meta tags, but this is canvas (running in an iframe), so that just stopped those views from displaying.
I also tried this form solution, but it didn't do anything (I could have been doing it wrong).
Is there any way we can build a button or link that will start the file download without opening a new browser tab?
Do you need to set the target at all? With no target set would it not trigger a file download popup in the browser, but leave the current browser window/tab on the same content?

Resources