Web Page for iPad: how to send data to server without PHP - ipad

I've developed a website that uses some PHP to write the client's user responses to a data file on my server. I've realized that the iPad cannot run PHP sites, and I'm at a complete loss as to what a good alternative would be. Javascript and HTML can't be used to write to a server, right? Help?
Thanks in advance.
Edit: I fixed it. The problem was that the iPad has problems with recognizing .click. I had to change it to .bind("click tap touch", function.... instead. It's weird how it was still able to recognize the click events that did not initiate a form submission (that is, when I was still using .click, the button worked, except for when it had to submit a form).

You'll need to put the PHP scripts up on a web host (e.g. GoDaddy.com or BlueHost.com) and then navigate to the website from a web browser on your iPad. The PHP will run on the server and so it will work whether you access it on a PC or an iPad.
While your developing, you could also access the server running on your computer from your iPad by navigating to http://<ip-address-of-your-computer>/myscript.php from mobile Safari or Chrome.
[EDIT] - Please note that the second option will only work while your computer and iPad are both on the same network.

Related

Cordova app, using remote website - How to handle connection issues?

My problem
I'm working on a project where Cordova is being used to display a remote website within the app. Cordova.js is being run from the remote server, etc., and this works pretty well.
I do have one issue though, especially on iOS devices.
If the device lose connection at the same time as I press a link on the website, the page will turn blank, as if to load the next page - but since the connection is lost nothing will be loaded into this blank page. Given iOS devices lack of back-buttons or such there's no way to navigate from this blank page except by closing the app and re-opening it.
My attempted, and failed, sollution
So, given that I can use Cordova.js to check for connection issues, I figured that I could use an iframe to display the remote website. If the connection goes bye-bye I'd just display a simple error message inside the iframe.
And well, this does work.
BUT. And this is a big but. InAppBrowser will not run from an iframe. And I can't live without the InAppBrowser, since it's used to display quite a few important features within the app.
So
Does anyone know a way to either:
a) Handle connection issues when running only remote content in the Cordova app?
b) Run the InAppBrowser from within an iframe? (I suppose I could use PostMessage etc. between the frames, but since I'm already sending/receiving data from the InAppBrowser I would love to avoid this in order to limit complexity).
c) Solve this issue in another fancy manner?

appcache not working any more - not loading offline

I have tested my website thoroughly offline (just using localhost). And I have never had a problem with appcache - such that I could load my website, disconnect my phone from the wi-fi, reload the website and I could still view it.
Now I have put my website online (ie. http://subdomain.example.com) - the code is exactly the same - and I try the same thing.
It will just not work. Chrome on my phone says wi-fi and mobile are unavailable and the page can't be loaded.
I just don't understand. Is there anything that anyone can think of that is different about working locally to working on a remote server?
If anyone else has this problem in the future, check your paths in .appcache
In turned out that the change between local and online (ie. 10.0.0.10/myapp/Symfony/mobile vs subdomain.example.com) meant that the / I had in the first line of my manifest was pointing to different locations on both local and online.

Another Stand Alone Web App Linking Issue

I have a mobile web app designed as a single place for employees of our company to help them locate various online resources. The app has a lot of in-app content, but also provides links to external partner websites. My issue is a common one with a bit of a twist. I like the way the app looks in standalone mode on an iphone, but am struggling to figure out a solution for keeping the app in stand-alone mode, while also providing the ability to open external links in safari. I know how to keep the app in standalone mode when links are clicked, but when an external link is clicked, one of two problems occurs:
1) If I code the external link to keep it in standalone mode, there is no way to navigate back to my app from the external site as the back button is obviously no longer available.
2) If I code the external link to open in safari, when the user is done with the external link, the session for my app is closed and the user has to go back to their homescreen and re-open it again. (I know I can code it so that they will return to where they were in the session, but this is not the solution I want).
My question is this, is there a way to open external links ON TOP OF a standalone web app session? So that when the external link is closed, the standalone web app session appears?
I've read that I can use AJAX to open external links within the active session, but I don't know how to do this and can't find anything online that explains it well. Any help would be MUCH appreciated.
My app functions fine in safari, but looks SO much better in standalone mode; I would be SO appreciative if anyone can provide a solution. I am also willing to discuss paying someone to help with this as well.
Cheers,
SC
Turn your app into an actual app, not just a web site. You should implement your own web browser in your app using UIWebView. It's very simple. You probably only need a back button and a close button, you don't need a full search/address bar, bookmarks, etc. UIWebView and two buttons will do it.
As soon as you switch apps to Safari you will see the behavior you have described - there's no getting around it. Your only choice is not to exit.
https://developer.apple.com/library/ios/documentation/uikit/reference/UIWebView_Class/Reference/Reference.html

How did a Captive Portal force to open a browser

I've setup a Captive Portal with dd-wrt, wifidog, authpuppy and some plugins from authpuppy as well as my own web app.
I am wondering what's the exact thing that will trigger a
browser on the client device to popup?
Is the popup browser from iPhone/iPad a regular browser mode?
It seems some JavaScript will fail on the browser mode, like the shake.js,
event though iOS Safari version is > 4.2.1 from https://github.com/alexgibson/shake.js/
P.S.:
I've done the research like
http://en.wikipedia.org/wiki/Captive_portal
https://personaltelco.net/wiki/CaptivePortal
they don't talk much about the popup browser.
Could anyone help?
If you will try to see the network statistics [request/response] you will find out that devices like ios and android both of them continuously hits some particular urls [in case of android it is www.google.com/generate_204 , don't remember exact url for ios]. These url are generated by system internally. These pings let their server know about various details. So as soon as ios gets connected with a captive portal it tries to hit the system generated url, failing to which it understands that this is packet level protected network and open the browser.
Hope this helps.

Retaining login credentials inside Mobile XPage added to Home Page

I have an application built using XPages' mobile controls. On an ipHone the application behaves as I would like in the standard Safari browser. When I take the url and add it to the Home Page as an icon and use the application from there every time an action I take invokes a native application (Maps, Contacts, Phone, attachment viewers etc.) when I switch back to my application I am immediately asked for my userid and password again. Is there a way to control the behavior to not lose the login credentials the same way that the standard Safari application seems to.
This is a limitation in iOS. If you save it to the home page like that it works, but it will NOT multi-task. That's the problem. So it doesn't remember where you were or anything like that.
As David mentions it starts all over again when you switch back.... The problem is not only the credentials - it is also all the information you may have entered or where you have navigated to in the "app".
This is why I am changing to another approach. I am starting to write apps as web-apps that run locally (i.e. cache the ressources and run on the cached versions of the JS-files, CSS and images). Then I implement a localstorage where you can track where in the app you are - and return to that place again. This way you do not need the authentication for running the app - only for synchronizing the information with the server. My approach is to save data locally and sync them to the server (as a sort of replication). This obviously gives more work - but it also gives a better user experience since you can run the "app" without being connected.
I have tried to control the caching locally using a cache.manifest file. This can be done, however, it is a pain. Therefore, I am now using Sencha Touch which really does this nicely.
/John
PS. I think you may be able to handle the login issue by using the XPage Dojo login custom control (http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=Xpages%20Dojo%20Login%20Custom%20Control) - however, it does not solve the issue with reloading the page...
It seems the secret to success here is NOT to tell Safari the XPage is capable of acting as a mobile web app. Add the following code inside for the XPage to ensure this is the case.
<xp:metaData
name="apple-mobile-web-app-capable"
content="no">
</xp:metaData>
Note: You can still provide an icon for the home screen, its just that icon will now act more like a bookmark with the Safari controls and (more importantly) you can switch between applications and when you return to Safari it will display your Xpages app just as you left it.

Resources