How to separate PWA session and cookie with a standalone browser? ( PWA as private tab ) - progressive-web-apps

I'm working on a PWA in conjunction with an enterprise application server.
The application server serves a responsive web view for a standalone browser, and customize the view on PWA with the help of PWA cookie which is set on PWA start url for the first time.
The problem is that the session between PWA and a standalone browser ( e.g Chrome on Android ) is being shared and once the user has installed the PWA, the consequent visits to the site with the standalone browser will show the PWA customized view.
Is there any way to separate sessions in PWA and standalone browser in device?I.e. to treat PWA as a private tab?
Or any other way?

I am in a similar situation and believe the solution is to differentiate the names of your cookies and/or sessions. So for example - my logged in user has a SESSION['Key'] but for my App I'll have to create one SESSION['AppKey']. It will (as in my case) require a bit of reworking of your code but I don't believe there is any alternative.
It is worth noting though that IOS appears to separate Cookies from the browser and PWA so you may find testing your scenario with an IOS based device may work as you expect.

Related

Capacitor Browser issue with Redirect

The Capacitor Browser is having issues with web redirects - with different behaviors in iOS and Android. I think this is a very buggy plugin, but maybe I'm missing something...
My Ionic app uses the Capacitor Browser plugin to present a Federation Login page. There is an "authentication URL" returned upon successful SSO login - or if the user is already logged in then there is an immediate "authentication URL" redirect.
Here's what I am seeing...
iOS: for a first time login, the web redirect works and deep links back into my app -- no problem here. However, if SSO is active, then there is an immediate redirect which the Browser ignores. I can see the URL change, and it works if I open it in a separate mobile web browser.
Android: for a first time login, the web redirect is ignored and the user is left stuck in the browser. Again, if I copy the URL to a separate web browser then it deep links back into the app.
Has anyone done this successfully or have any workarounds? I've tried the "Cordova" and "Awesome" InAppBrowser versions of this plugin, and they don't redirect at all (although they have a bit more control over closing the browser, etc.).
I encountered a problem like this on Android lately,
The in app redirection was down on Android 12, users where locked on a white screen where we normally get the token in the url and redirect in app.
In my case it was related to this :
https://developer.android.com/training/app-links/verify-site-associations?authuser=2
The chrome browser was trying to check this file to verify the hash of the app to perform the redirection but it was unavailable due to internal network configuration, so it was locked.
This check seems to append on Android 12 only, and needed a re-install of the app on users devices (cache on in app browser ?).
Hope this can help.
(Ionic 6 Capacitor)

How to set up different start url for Ionic PWA app

I would like to know by any chance I can differentiate the PWA pages from mobile browser and PWA app. My requirement is to show a different page on with the information to Add to Homepage option when app opened on mobile browser once the user added the App on homepage then it should act as normal mob app.
I see there is a start url given on manifest and I tried to change it with no expected outcome... Pls let me know how to do it.. any practical example would be really helpful
Changing start_url is the correct way to do this. For example "start_url": "/?source=pwa". Keep in mind though that for a PWA installed via a browser you will generally have to uninstall the PWA shortcut and install it again for the manifest.json cached on the device to update.

MobileFirst: Mobile Web - Page refresh to keep session alive

I am developing a MobileFirst based Mobile-Web app using Angularjs. In case, a user refreshes the page then all files get reloaded again as per standard browser behavior. This causes the user session invalid, how should we handle this ? disabling the refresh button is not good option.
Environment:
MobileFirst v7.0
Angularjs 1.4.3
any browser
The Mobile Web environment has support for cache manifest, which allows caching files so that even though you reload/refresh the web app it will know to not reload all resources from the server. You can attempt implementing it to see if it alleviates your issue.
See more here: http://www-01.ibm.com/support/knowledgecenter/SSHS8R_7.0.0/com.ibm.worklight.dev.doc/devref/c_optimizing_apps_appcache_procedure.html?lang=en

Chrome App - Options to change URL for hosted apps

I am creating a hosted app for chrome web browser. I want to include an option for this app so that user can specifiy the URL that the app opens by default. For example, they may want the app to open http://myapp.com/username or http://myapp.com/somethingelse.
Following this, I added "options_page": "options.html" to my manifest file and added options.html. However, I couldn't load the app. My browser said:
Could not load extension from '/home/cookiemon/path/to/myapp'. Invalid value for 'options_page'. Hosted apps must specify an absolute URL.
Does this mean, for hosted apps, I can only include a URL to a page on a web server?
Yes. Hosted apps aren't much more than bookmarks with slightly enhanced capabilities. Moreover, they're legacy app types that will likely be deprecated. If you want your app to work offline, build a Chrome App.

Is it possible to show a Facebook app as a Page Tab on mobile devices?

For example, the following URL shows the app in a tab:
https://www.facebook.com/just.to.get.a.rep?sk=app_203403406338325
But when on a mobile device it redirects to the mobile site and does not show the tab or even have a link to it:
https://m.facebook.com/just.to.get.a.rep?sk=app_203403406338325
I even have the application tab set as the Default Landing Tab for this page, but cannot get the pap to show for the page. Is there another format we need to develop for the App to support mobile? Ideally we would like to show the tab on iPhone app and other mobile viewing.
If you're in control of the link the user clicks on to reach your fanpage/pagetab-combination, then try adding a GET parameter ref=ts
h++ps://www.facebook.com/just.to.get.a.rep?sk=app_203403406338325&ref=ts
Apparently this prevents the redirect to the mobile version of facebook.
There's not currently any way to see App-provided Page tabs on the m.facebook.com site
Mobile web apps are supported, but they're not tied to the Page and need to be manually linked-to or bookmarked, the tab functionality simply doesn't exist now.
Currently you can develop application functions such as app authorisation but sadly no, you can't display standard iFramed tab apps, I suspect this is because of slow 3G data speeds and the fact that Facebook wouldn't want the mobile experience being any slower than it already is (dependent on external hosting etc).
Many of my larger clients are begging for it. The only workaround I use is to build an external page with the same content used in the iFrame - then you can direct users to the tab or mobile users to an external link.
https://www.facebook.com/pagename/app_000000000000000?ref=page_internal
as of now ref=page_internal is working as a work around.
You can redirect Mobile users to a specific mobile website, and have desktop users redirected to your page tab app.
Detailed instructions for doing this are available here:
https://stackoverflow.com/a/15860533/121285