I have a website that if running on a mobile device such as Android table or more importantly Kindle Fire, if goes into a wifi scenario where the connection is not too good, it times out randomly. The site has a jquery ajax keep alive but it uses the root domain url to do this, and what seems to be happening is that the Kindle times out trying to re-do the current page url.
Can anyone suggest how to for the aspx website that uses a masterpage, upon keep alive, to do its reload from cache and not a full url reload, as the full reload seems to be the issue.
I have tried the google offered options, and I know how to check for the device (i.e. is the site desktop/laptop or mobile device), but not how to make the Kindle browser use cache but a kept alive url).
Related
I'm using a web framework where everything gets passed through a websocket. New / updated DOM elements are shipped over to the browser, events get shipped back to the server. Works great. Except when the websocket gets closed.
This happens...
when using desktop/mobile Safari's browser navigation buttons are used to leave & come back to the page
on mobile Safari after a timeout when switching to a different app, tab or screen locking
when the WiFi goes down etc.
After that the user simply sees a normal looking page, but everything is obviously dead as no more updates happen and no more events get relayed to the server. I'd like to simply refresh the page in that case. Either everything goes back to normal or the user sees a connection error in case of no network etc.
I tried poking around in the framework's code, adding "window.location.reload(true);" to the "onclose" handler for the websocket kinda does the trick. My state is 100% on the server, so reloading the page will just fix things.
Assuming I can't modify / fix the web framework I'm using, and it doesn't have any onConnectionLost client-side event, what's my best option to detect this scenario and reload the page? Are there any events like 'onPageDisplayedButNotProperlyReloaded', 'onPageVisibleButHasBecomeStaleInTheMeantime', 'onWebSocketsClosed' for me to use? Can I just open some dummy websocket and reload the page when it gets closed or something? Any other good way to detect this?
Thanks!
We have an web application. When we try to access the site using wifi connection the site loads perfectly but when we try it with the cellular data (3G), it opens the site but some of the elements are not loaded.
So we tried doing some testing.
It turns out if you load the page first time using wifi then it will start loading afterwards on 3G as well until you clear cache and cookies. Wifi connection and 3G have same bandwidth and ping.
Our web app uses lot of javascripts and ajax calls to retrieve data. We added cache: false in every ajax calls to prevent caching. When that didnt seemed to work I added timestamp to the url as well which also failed to solve the problem.
The issue seemed to be related cookies somehow because once cookies are set the web app works fine.
Does anyone know what could be the problem?
I have a desktop and adaptive (with media query in css) design of site. How can I show desktop version of my site if user come to it from mobile gadget? There is only idea in my head:
Set up cookie (for example siteVersion = mobile) previously.
If user choose desktop version (via clicking button, link...however) set up this cookie to "desktop" and after refresh page load css with desktop design.
Does anyone have other ideas? Maybe someone has someexperience with it?
So, what #jared gotte said - "adaptive" implies a web page that can adapt to the device capabilities without having to serve up different content from the server. So in that regard your question is a bit nonsensical.
But, that said, the way most [large] sites handle serving different content to mobile .vs. desktop is by setting up different subdomains. For example Facebook uses www.facebook.com for the desktop version of the site, and m.facebook.com for the mobile version. When a user first hits the site, the server looks at the User-Agent header to decide what type of device they're using and redirects them appropriately. If/when you want to switch them between the two on the client, you can use JS to redirect their browser.
The caveat to this is that you'll need to setup the DNS hostname(s), and make your server code aware of the Host header on incoming requests.
Put your desktop CSS in one CSS file. Put your adaptive stuff in another CSS file. Serve both to the user. But then if a user says "show me the desktop version", stop serving them the adaptive CSS file.
I am currently making a web app and I have used a manifest file to get my web app to work offline. This works great and using Google Chrome, Opera etc I can view what is being cached by right clicking, inspecting the element and viewing the resources.
The problem I have is that I want to view what is stored in the cache in the app when it is being used on an i-pad. I have give this a Google but cant seem to find anything. Is there a way of displaying what is stored in the cache using some JavaScript or JQuery and then having this displayed on a web page within the app.
The app consists of a webview which is currently pulling in other html pages which are being stored in the cache using the manifest. I want to add a simple settings page where what is being stored in the cache can be viewed within the app. Hope that explains enough I would really appreciate any help with this matter.
I don't know of a way to get at this information with JavaScript either, but here are the alternatives I use.
In Mobile Safari, I connect the device to a Mac, open Safari on the Mac, open the site in Mobile Safari or open the native app going to the screen with the UIWebView, go back to the Mac and open the Develop menu. From there you can select the Storage option and view what's in the appcache.
In Chrome, you can view what's stored in the appcache using the URL chrome://appcache-internals/.
If the appcache was saved successfully, you could also simply go to the file itself in your browser.
I am in the proccess of making a site, i want a desktop version and a mobile version. What javascript code do i need to put into my html code to detect what device is viewing the page and if it was a mobile redirect it to my mobile verson of the site? my second problem is how to make a link back from the mobile site to the desktop site?
The best way would be to do it at the server level, or back-end level before it even reaches the user. It's a bad user experience to land on a web page, wait for it to load the javascript and then redirect again.
Jayesh answer should work, however In the future it might be handy to design responsively (content that automatically scales to the users screen size) to minimize loading times and maximize efficiency!
There is lots of help on this,
It is done by checking user agent property,
String userAgent = request.getHeader("User-Agent");
you can visit,
Detecting Device Type in a web application