I have a web site that I'd like users to be able to add to their home screen. Users will switch between this saved "web app" and a game frequently.
The first problem is that when a user comes back to the saved "web app", it displays the splash screen every time even though it wasn't closed. This is undesirable. Further, when a users clicks on a primary navigation element, it switches the user over to Safari.
How do I get the app to "save state" and not re-load the app when coming back to it (when it hasn't been closed)? How do I get it to load links clicked within the same domain to load within the saved "app" rather than loading them up in Safari?
Safari doesn't reload a page when you switch away from the app and come back, so why does a web site saved to the home screen have to reload when pulled to the front?
I don't want to use an offline database, I don't even need the app to work while offline because it needs to tie to a live database that's constantly changing. Therefore a working offline isn't intuitive because the data would be outdated and irrelevant. Therefore, I don't need cacheing either (except maybe a few resources that don't change often). I just want the darn thing to "save state" and not reload every time the user comes back to it. And links clicked within it, shouldn't take the user out of it unless they are links to a different domain.
I've searched and read and searched and read, but I'm not finding anything other than articles about making a web app work offline. That's not my goal. My goal is to make it behave like Safari does in that if it's not explicitly closed, it keeps it's state.
Related
This is an intermittent behavior with the progressive web app version of my site.
I made a website with React. Then I visited it with my iPhone 5 and saved it to my Home screen with Safari's "Add to Home Screen" feature. The behavior is different between (1) visiting the site using the home screen shortcut and (2) opening Safari and going to the page that way.
Doing (1) has the problem. If I do that and then go to the Home screen and touch the shortcut and go back to the website, the page turns all white for about 1-5 seconds, the internet connecting indicator spins and the page appears. Sometimes the page returns to the state I left it and sometimes it reloads entirely. Doing (2), the page doesn't reload at all and doesn't try to access the internet. Same with accessing the site using Chrome.
It seems to completely reload more often if more time has passed since I .
According to Chrome developer tools, a Service Worker is activated and Lighthouse gives the site a perfect PWA score.
I have questions... Why is the behavior different when accessing the page these two ways? Why is it trying to access the internet or doing anything at all every time I switch from the Home screen or another app to this app? Why is it totally reloading the page sometimes? How do I make it not do this? I want it to work offline and I want it to not attempt connect to the internet unnecessarily.
Currently we have universal links which look like http://example.com/sharing/< id >/ which open our iOS app through the safari smart banner. But smart banners sucks, so we'd like to use the Branch.io journeys banner, which actually appears when people load the page. Since these links are already in the wild, they need to continue to work have have some way into the app. In the future we'll generate branch.io sharing links from inside the app, but these landing pages on the web will continue to exist.
I'm calling branch.init('key_test_foo'); from javascript, and the Journeys banner appears. It only ever shows the "Get" button and never "Open". I'm not clear how I pass the object ID through branch.io so that the app can navigate to the right place.
The app is built in Xamarin, and I think I have the integration built correctly following the example. It is not in our production build through the app store, I'm just running the app through the debugger in Visual Studio.
I'd even settle for an "Open in App" link like imgur has, as long as there's something I can click in safari to open the app in the right place.
I don't feel like I should have to "make a link" every time this page gets viewed, right?
EDIT:
One additional question. I think I want to change my og:url so that when facebook scrapes my page, it will open through branch (instead of back to my site). But how would I set that? Facebook isn't going to run any JS when it loads the page is it? Can I just set it to my.app.link and magic will happen from the al:ios:url that drives the deeplink routing?
I think this: https://stackoverflow.com/a/34596340/401636 might be the solution.
1. The Journey's banner navigating to your app.
Branch uses the domain of the format -alternate.app.link domain for the link behind the Journeys button. To ensure that clicking on Journeys CTA, navigates to your app ensure that you have added the -alternate.app.link domain for your app in the 'Associated Domains' file. You can check the documentation providing information on how to add the domains here.
2. The Get v/s Open issue for the Journeys CTA
Branch uses a variable has_app to determine whether the device has the app or not. For this variable to be set to true, a user should click on the Journey CTA and be redirected to the app (not the App Store). Also, the issue of the CTA not updating is common during development, because the app is frequently re-installed on the device. Due to this testing, the flag, has_app, goes in a faulty state.
To force reset the has_app variable to change the Journey's banner CTA from 'Download' to 'Open', please follow these steps:
Click on the Download button - this should redirect to the Play or App Store
Install the app
Return to the web page with the Journeys banner, which should still display the Download button
Tap on the Download button again - the app should open
Close and then re-load the web page with the Journeys banner - the banner should now have an "Open" button
Tap on the "Open" button
Please note that the above steps are required only during development mode for testing purposes. Out in the wild in production, users will not see this issue. Also, it might take some time (as long as 30 minutes) for the flag to updated.
3. Navigating to the right place in your App
If you plan on using your old domain links for deeplinking, you can update your Link domain on the Branch dashboard to the domain your links are currently using. You can then recreate the links again with the Branch API. Please note, Branch will be the authoritative registrar for your domain and you cannot host anything on this domain.
If you do not wish to do that, you can append additional link parameters to your Journeys button. These link parameters will be available in your app when the user clicks on the Journey CTA and is redirected to the App Store/your app. You can refer to the documentation here for more information.
For both the above scenarios, in order to read the link parameters in your app, you should integrate the Branch SDK in your Xamarin app. (Reference documentation here)
If in case user close application or click on the home button also
---Thanks in advance.
Apple restricts app developers to access certain parts of the software, in order to protect the security of the users. That being said, accessing the back to app button cannot be changed or modified inside your app, because it is not a piece of software which belongs to your app.
From what you have described, it seems that you want your app to just take control of your user, putting that button there whenever the user exists your app. It is not the case.
We are currently building an iOS app and we need to get it submitted asap, however, one of the features are not quite ready so I am thinking as a temporary measure to put in a button which when clicked opens an external page with a html 5 web page within the app and the user can fill in their data and continue within the app as if they never left.
Obviously there will be some minor difference between the web page and the actual app but the key is we don't want people leaving the app, I just need the html 5 page to load inside the app so the user gets a good experience.
Is this possible and what is the best way to execute this?
I am building an iPad app to be used in a public multi-user scenario and want to allow temporary web browsing sessions. However, when the session is finished, I want the app to clear all private browsing data including cache, cookies and history.
I have figured out how to clear the cache and the cookies, but the history is eluding me.
Just to be clear, I'm not looking to clear the back/forward history of the UIWebView (I am creating a new instance of UIWebView each time so that isn't an issue). I am looking to clear the entire application's browsing history, so that links do not appear visited.
For example, if I search for something on Google and visit one of the hits, the link turns purple the next time I Google it. I want all history and past web pages to be erased so that no links stay purple after the browsing session is reset.
Alternatively, if I could just entirely disable history tracking (like a "private browsing mode" à la Chrome or Firefox) that would also be acceptable.
Update: Interestingly, I noticed that quitting and restarting the app implicitly clears the browsing history, and links once again appear blue upon startup. However, this unfortunately doesn't help me at all because the app is designed and intended to be run for long periods of time across many users. We can't quit the app after each session.
Update 2: Further experimentation shows that the web history is definitely maintained on a per-application basis. I googled the same thing in Safari and the links that show purple each time in my app appear blue in Safari. There has to be a way to access this local storage from within the app.
If you are willing to use private frameworks, there is a discussion about this here: How to clear back forward list in UIWebview on iPhone?
If thats not an option for you, then the only other option I can think of would be deleting the webview and then recreating it.