iPhone Mobile App (safari): which javascript events like onblur, onfocus or onbeforeunload are available? - iphone

So I just made my web-application "iPhone Friendly". So you can add it to your home screen and it has an icon, no chroming, etc etc.
The problem is that I want to display a custom splash-screen every time it is opened from the iPhone home screen. Right now it just shows the last screen viewed while it basically runs a refresh.
I have tried attaching events to window.onfocus, window.onblur, window.onbeforeunload, and NONE of them seem to work right when the app is being run in "mobile-app" mode.
Am I being dumb? Er.... don't answer that. Does anyone know what is wrong?

Unfortunately, with the restrictions Apple imposes, this is impossible.
My recommendation is to create a App Store application with a full-screen WebView. Then, you can use a default.png file and a ImageView for your splash screen. Also, you get a ton more visibility on the App Store. (Also, if you go this route, check out PhoneGap - http://phonegap.com/).

Update!! In the iPhone 3.0 update, mobile safari now supports the ability to specify an image to be used on startup:
Remember this only works with iPhones that are running 3.0+

The loading screen you are talking about is the loading screen for an APPLICATION, not a webpage, i.e its the loading screen for Safari. This has nothing to do with "the restrictions Apple imposes", just with the fact that because your web app still runs in the browser, the browser needs to load first. Like was also said, if you want to get around this you need to build your own app, in which you can specify the splash screen.

Are you using this?
<meta name="apple-mobile-web-app-capable" content="yes" />
If yes, it should refresh every time when you exit the web app and enter again. It will NOT show the last screen viewed. Hence you can show your splash-screen every time when it is opened. In another words, you should show a full screen div / image every time when you load the page.

Related

Can I hide Flutter app contents when the app is in Background?

I'm developing an app that works with sensitive information.
One of the requirements is that when a user puts the app in background the content that the app is currently displaying has to be hidden, so if another person navigate through the apps in background he can't see the last screen where the user was.
Any ideas on how to do that?
I tried to show an overlay when the app moves to AppLifecycleState.paused, but it doesn't work for me, the app prints a message if I want but it can't update the UI.
Edit
Shameless plug: i did a library for doing just that as I also needed it:
https://pub.dev/packages/secure_application
Answear
Build is not called after paused, at least on Android.
For Android I used a flutter_windowmanager package (modified to still be able to build on IOS):
https://github.com/neckaros/flutter_windowmanager
When my app need securing I add the flag secure:
FlutterWindowManager.addFlags(FlutterWindowManager.FLAG_SECURE)
And my app is now a black screen in the app switcher.
You should still hide content your way for when the user get back to the app.
Otherwise you can go native:
https://medium.com/#mehmetf_71205/securing-flutter-apps-ada13e806a69

How do you clear image cache in iPhone 5S Safari browser?

Please forgive me if this question sounds like clearing Safari cache/cookies in General->Settings.
The issue is as follows:
We have a custom webpage where user can upload his profile icon/image by choosing from Phone's photo library or taking a photo.
The 1st time user uploads an image P1, it's uploaded successfully to server.
If user refreshes the webpage and tries to upload a different image P2, P1 is uploaded to server.
Problem persists even after clearing browser cache.
If I kill browser and clear cache, then I'll be able to upload a new image.
This problem does not occur on browsers on Google devices or on PC.
Somehow iPhone browser remembers the image object and I need to find a way to clear it.
Launch the Settings app from the Home screen of your iPhone or iPad.
Scroll down and tap on Safari.
Now scroll all the way to the bottom and tap on Advanced.
Tap on Website Data. Notice here you can see how much space on your iPhone or iPad website data is taking up.
Scroll to the bottom again and tap on Remove All Website Data.
Confirm one more time you'd like to delete all data.
Launch the Settings app from the Home screen of your iPhone or iPad.
Scroll down and tap on Safari.
Now scroll all the way to the bottom and tap on Advanced.
Tap on Website Data. Notice here you can see how much space on your iPhone or iPad website data is taking up.
Scroll to the bottom again and tap on Remove All Website Data.
Confirm one more time you'd like to delete all data.

iPhone start screen latency

Im wrapping a html5 website in a native app. The app splash screen appears for a sec then a white page appears, I decided to add an image view that have the same image as the splash screen to fill this white screen and I hide this intermediate image once the websites download all the jquery and CSS. However, this screen lasts for really long time (up to 30 sec.) so I thought that it may be due to the jquery and CSS large buddle downloading time. So create a page which has and image and a redirect js(non library) statement and found that redirects so fast. I cannot understand why, anybody have an explanation
That's the expected behaviour when attaching a web view
You may want to consider that your app plans may run afoul of App Store guidelines:
Apple can reject mobile web shell apps.

Sencha Touch 2 - Iphone app - blank white screen

I am building iphone app using sencha touch 2 command. App works fine except, when I open it on iphone it shows splash screen and then shows white blank screen for 1-2 seconds. I believe it could be the issue of gathering all sencha js files to execute. But is there any way, we can show temporary screen instead of white blank screen?
I am not using phone gap to build iphone app.
Thanks,
Viral.
In phonegap based applications, there will be a provision for increasing the splash screen duration. Search for the same thing. You may find a solution for the way you are building your app(not phonegap)
Edit: Try lazyload.. i.e., while the content is loading use a throbber like thing. Because blank screen may seems to be like the application is not working properly

How to relaunch an Air-based iOS application from the very first page?

My application is an Air-based iPhone app. It opens with the last page I visited before clicking the Home button, each time I relaunch the app, while I need to open with the splash screen onward. How can I resolve this issue?
Thank you for any help.
When you press the Home button, you don't terminate a running app. I'm sure that many of us developers have stuck with this mental model of how iOS used to work without multitasking.
So, the splash screen, or rather, the default image (Default.png) should really appear once (when your application launches). Some times, the default image appears when coming out from the background state, but this happens only if your app takes too long to show its UI. In fact, on fast iPhones, the default image disappears almost instantly even on launch (for well-written apps, that is).
I should also note that Apple actively discourages the use of the default image for splash screens. These should only be used for creating an illusion of transition, from a "launching state" (which the default image is supposed to portray), to the running state.
However, if you really have to show a splash screen every time, you should implement such a mechanism in code. applicationDidBecomeActive: is a good place to start, if you are writing code in Objective-C.
I don't know the event model in Air, so I can't really give you any hints for that.
The above answer, though old, does not answer the question. Sure, Apple gives guidelines regarding splash screen and all, but the poster asks how to prevent the app from resuming from it's previous position. If you want the app to terminate when put in the background you need to look into the UIApplicationExitsOnSuspend option. There's also an Adobe blog post explaining a bit more about different background behaviors.