How to change Wicket behaviour on Page Expired - wicket

We have a wicket application for our main website. Lately we have implemented a mobile version of the site. The mobile version is special in that it is deployed inside a native app wrapper to some mobile devices and not connected to the rest of the page through links because it is not supposed to be normally visible to web users.
The mobile page makes use of ajax and is therefore prone to receive "Page expired" errors for example when we restart the application on the server.
Since that page is not connected to the rest of the application through links I do not want our standard "Page expired" behaviour. Is it possible to override or intercept this behaviour for the pages belonging to the mobile part of the site? For example I could like to be able to configure the pages to simply reload on a "Page expired" error.

Yes,
getApplicationSettings().setPageExpiredErrorPage(YourPage.class)
YourPage.class can then for instance be your HomePage or another Page that depending on it being a request from a mobile device does something else.
If you would like to reload the Page the user was one then it becomes a bit less trivial. Reloading the Page is not possible since you are not on the page anymore. You could have a look at IRequestCycleListener and overriding onException and handle PageExpiredException yourself but it is a dangerous road you travel if you simply reload your Page. Navigating to the home (or other) page seems more logical. I assume you are not restarting your server 100 times per day...

Related

Should a PWA be a SPA too?

I was wondering that because my app does have an initial journey that is totally diferente from the behaviour of the app.
I would like to separate this initial journey into a different "HTML" due data transfer and load time. Even not using the same framework (Angular2) as the rest of the app.
But this way the app is not a SPA anymore.
Does this harms the "Connectivity independent" or "App-like" PWA principles?
Obs. We are trying this because our researches shows direct relation between user engagement and speed of the loading time of initial tour.
Following the single-page app pattern for your web app means that you'll have a smooth transition to handling navigations cache-first in your progressive web app, using an App Shell approach.
Following the App Shell pattern isn't the only way to build a progressive web app, but if you take a different approach, you'll need to put more thought into how you cache your HTML, and you might have a harder time using a service worker to respond to navigation in a cache-first manner. Some of these considerations are outlined in this "High-performance service worker loading" article.
If your web app is currently a hybrid of a SPA along with a few static pages, then you can take that into account when you respond to navigation requests in your service worker by examining the incoming URL. Assuming there's a well-known prefix or other way of identifying whether a given URL corresponds to the SPA portion of your web app or the basic HTML portion, you can respond differently inside your fetch handler:
// Not shown: install and activate handlers to keep app-shell.html
// cached and up to date.
self.addEventListener('fetch', event => {
if (event.request.mode === 'navigate' && event.request.url.includes('/spa'))
event.respondWith(caches.match('app-shell.html'));
return;
}
// Either do nothing, and your non-/spa URLs will go against the network,
// or use a runtime caching strategy to handle your non-/spa URLs.
});
Updated on 2018-06-21: For an additional perspective, you can read "Beyond SPAs: alternative architectures for your PWA"
The short answer is PWA need not be SPA.
If we look at the documentation website of Web Firm Framework you can see it is not an SPA but it is a PWA. If we refresh the page while offline it works. We can also do "Add to home screen" in mobile chrome to add it as an app which brings App-like experience.
So to get an App-like experience your home page and some of its links must be able to be cached.

How to handle navigation within a Facebook page tab application

I am working on a page tab application and am having an issue with navigation. My application, written in MVC3, is displaying and authenticating just fine as a page tab. When I click on my tab, my app receives a POST with the signed_request object as expected.
My question is, how can I support links to other pages in my application? When a user clicks on a link, I want an action to be called in my application and to not leave the Facebook iframe. In addition, I need the signed_request to be passed along so I have a user context.
At first, I thought this was not supported and that all page tab applications had to be written as Single Page Applications. However, I found examples that do exactly what I am looking for.
Click on an image:
https://www.facebook.com/Sephora/app_305927716147259
And:
http://woobox.com/pinterest
How are these apps handling page navigation within the iframe?
The performance of clicking on an image seems to be pretty bad. What are they doing behind the scenes and is there a more direct way of handling navigation?
I will also need to handle POSTs.
Thank you.
When a user clicks on a link, I want an action to be called in my application and to not leave the Facebook iframe.
Well, that’s what normal HTML links do – so no extra effort required at this point :-)
In addition, I need the signed_request to be passed along so I have a user context.
You could pass it as a GET parameter with every link – but this way the user can easily “see” it, and it might also get transfered to external servers (if any external resources are embedded within your page) via the HTTP referrer.
The better solution IMHO is store the signed request server-side in your session (parsed already, if you like), so that you have access to it on the following pages of your app.

New Mobile Version of Facebook on Iphone doesn't follow default page listed in Fan Page

Up until about 2 weeks ago, if you visited a Facebook Fan Page on an Iphone through safari (not the Facebook App), it brought you to the normal internet version of the site. This made it very easy to have control over what people saw first when they visited the page by creating an app and then specifying the app related tab (page) as the default landing page for users.
In this way you could include a "like / reveal" (Fan Gate) page and have the same type of incentive and offer translate directly to the iphone viewers as it had been seen on the internet using a computer. (still not sure how it looks on Android)
Since they added the redirect that forwards mobile browsers to their m.facebook.com page, if you try going to a specific fan page, it brings you to the "Wall" as the default and doesn't seem to even show the special tabs you created through an app -completely ignoring what ever defaults you had set up in the app!
Has anybody figured out a way to have a mobile browser pay attention to the default page named in the app or somehow disable the mobile browser redirect so it goes to the standard page. This is very important for using with QR codes, since you used to just link the QR directly to the fanpage address and it worked pefect, but now simply leaves the people a little confused about the offer you were promoting.
Thanks for any help on this!!!!!

How would I go about creating a Facebook Fan Page tab that contains a Poll?

I'm not sure why but creating any kind of integration beyond the use of social widgets and buttons on external sites always confuses me.
What I need to do is create a tab on a particular Fan Page. This tab needs to:
Contain an interface for casting a vote in a Poll.
Handle multiple Polls. Only one will be featured in the tab at a time, but there should be an interface for navigating to previous polls.
All polling data needs to be stored on my servers - 3rd party Polling solutions (facebook apps, or embedable services) are not an option unless the data storage location is configurable.
All those requirements are pretty easy to address. Im just confused about how to integrate with FB.
Do i need full FB App for this, or is there another way? This will only be accessible via the Fan Page tab, so I don't necessarily need an App at apps.facebook.com.
If it is an app... is there a way to hide the app page, and the standalone app canvas from everyone except Fan Page admins?
FBML will be discountinue very soon. You might need to find an alternative way to do it. :-)
Check out the Static FBML app that Facebook provides. You can implement it on any Facebook fan page, change the tab title, and specify the content in HTML/FBML (with some limitations, I believe IFRAMES, password inputs, and some other random things are not allowed, but don't take my word on these until you test them). Hopefully this at least gives you a little head start.
Even Tradablebits platform is an option. They give a good functionality and make it simpler to work with Facebook. http://apps.tradablebits.com/ I analyzed this platform for one of my apps.

facebook tab fbml and dynamic content

Per the new profile/fan page tab rule that eliminates the iFrame option, is there a way to dynamically generate content for a given tab? I've seen methods that wrap a canvas app (but requires a user to click to load content), but I want to show updated content thats managed on my servers. I thought you could also update the FBML using the Graph API, but haven't been able to find anything on that.
You can display static FBML on Application Tabs which is dynamically generated, you just can't auto-load anything that's dynamic on the client side (until the user clicks something)
You'll need to make sure you setup the application to be installable to pages as well.
Go here for help on all things social media, especially FBML.
www.facebook.com/fanpagefactory
ask questions to the community or in the 24/7 live chat (you will get a timely response either way)
Enjoy.