Page disappears from cache after first redirect on chrome - html

I am trying to divert the user to an offline page when he comes to my site and the device is currently offline.
The problem is I trigger the caching from the home page itself so the problem is when the user comes to my url he comes to the loading page itself and not the offline page I would like him to go to.
What I do is using js redirect the user if the manifest is not available
function errorCache(event) {
//Redirect for error event of manifest
var offlineURL = 'http://myUrl/OfflinePage'
window.location = offlineURL;
}
window.applicationCache.addEventListener("error", errorCache, false);
Now this works perfectly the first time the user goes to the page. The next time I go to the homepage though, it redirects me to the offline page, but the offline page is not available anymore.
Any idea if this is a chrome issue or a HTML5 behavior and how can I retain the offline page?
thanks

Related

Why chrome shows alert randomly when try to open custom protocol url with location.href?

i had took a look to another threads about chrome and custom protocol apps, but i couldn't resolve a doubt i've got. In my web app, when you click a button it fire a new tab with an webpage (window.open(url, "_blank")). The new tab is opened with the url (annother web app with https protocol). This url fire a javascript function on load that verifies some things and then generate a custom url, for example myurl://base64code, and put it in an existing iframe in this way windows.frames['myframe'].location.href=theCustomProtocolUrl. i tried in different ways (location.replace, create a new iframe and set the url, etc) and i always have the same problem. If i refresh (ctrl f5) the page it always show the dialog or if i open the link with the developer console opened. But if i click my button and the page is opened in a new tab it doesn't work only if i refresh (ctrl+f5). This works perfectly on IE11, it launch the app directly.
Any ideas why chrome, and edge, works like this?
UPDATE: I have found the reason, is i use the protocolcheck.js (https://gist.github.com/vladimirtsyupko/cfcd332476b16683bb0b) library.
First i tried to open a protocol with the timeoutHack (it use blur event) and then, after failing, it fires the other url (in this case https) and the dialog doensn't appear. I found a bug with blur event on chrome > 85 https://bugs.chromium.org/p/chromium/issues/detail?id=1137801
Thanks in advance

Github page is not showing and keeps loading

I have published a Github Pages under this link: https://rochanofa.github.io/unesco-seasia/. It is a web-map application based on OpenLayers library.
However, the content of the page is not showing and the page keeps loading forever.
When I open the index.html file in my local directory the content is displayed on my web browser. Here is the screenshot of the webpage when I load from my local computer.
What could I possibly do wrong?
The link to the repository includes the javascript code: https://github.com/rochanofa/unesco-seasia
Looping redirects
I can't tell where it's coming from in the code, but if you load the page with the network tab open, and check "Preserve log" it appears that the root / redirects to unesco-seasia/ and that page redirects back to /. Normally browsers catch this, but it's using HTTP 307, instead of 302 or 301.

Stop redirecting back to the login page when the app is refreshed or reloaded

I have a web based application which the client side is implemented using angularJs. When the browser is refreshed after login into the application, the app again redirects to the login page. It will not stay in the same page where the reload is triggered. Any suggesting solutions would be highly appreciated?

Navigation back causes page reload in Chrome

I have a single page PHP application that fetches data from a third party API and outputs the items in a product grid. Clicking on one of the products leads to an external url which opens in the same window.
When using the back button in Chrome to go back på the application after clicking the external link, the page reloads for some reason. I'm only experiencing this problem in Chrome, therefore I'm wondering if it could be a Chrome related bug?
Found the issue. It was caused by using a window load event incorrectly.

How to make the back button work after pushState in Chrome / Safari

I have an error handler in my single page app that reloads the page if the ajax request fails for some reason, displaying the error response to the user. With Chrome and Safari, a subsequent click of the back button will leave the user on the error page (though the url will be updated back to the original page.)
Minimal code to reproduce:
var missing_url = window.location.pathname + '/missing'
window.history.pushState({test:'test'}, 'new page', missing_url);
// Reloading will return the 404
window.location.reload();
Demo: http://bl.ocks.org/lrowe/raw/5551102/
Source: https://gist.github.com/lrowe/5551102
As far as I can tell this is nothing to do with caching, when clicking back nothing shows up in the network panel and I see the same behave when the browser cache is disabled.