Preventing iframe caching in Chrome - html

I have an emulator I wrote for testing smart TV web apps. The emulator itself is a web app, with a simple interface that showing a TV and remote, and loads the web app being tested inside an iframe. Users launch the emulator from the command line, which starts up two simple HTTP servers (one for the emulator, one for the web app being tested), then starts up chrome using the --app command line switch pointing it at my emulator.
The problem is that every time Chrome launches, it loads a cached version of the web app. If you made changes to your web app since last launch, they aren't shown until you do a hard refresh of the page.
To get around this, I've tried the following:
Launching Chrome with the addition of the --disable-cache switch
Appending a random query param to the startup URL passed to chrome (ex: --app=http://localhost:6001/?random={some_hash})
Appending a random query param to the web app URL specified in the iframe
None of these seem to do the trick, however. The emulator code doesn't appear to be getting cached as the src URL in the iframe does indeed get a new random value appended to it every time. However, the page loaded in the iframe is old, and always requires an refresh after initial launch.
Any other things I can try that I haven't covered above?
Further example of issue:
User launches emulator for first time for web app 1
Web app 1 shown in emulator
User closes emulator
User launches emulator for web app 2
Web app 1 shown in emulator
In this case, the emulator would launch and still show web app 1. It continues to show web app 1 through refreshes until the user performs a hard refresh (cmd+shift+r), at which point web app 2 finally displays.

It sounds like this might be related to the bug here:
https://code.google.com/p/chromium/issues/detail?id=324102
As a workaround, I found that setting the iframe src from javascript ALONG WITH appending a random query param to the URL seems to do the trick. Simply doing one or the other doesn't work.
Example:
// still loads stale page
document.getElementById('tv-screen').src = 'http://localhost:6001/';
// will load fresh page
document.getElementById('tv-screen').src = 'http://localhost:6001/?rand=' + Math.round(Math.random() * 10000000);

Related

Chrome native messaging - disconnected when launching another app

What I'm trying to do?
I am trying to write an application based on such schema:
The chrome extension launches an application (.jar file) on my computer
The application launches another application (external, not written by me), I am passing data to it, it displays the window for user, user enters some data to it, and then this app returns the data to the parent app
The parent app processes the child app response and sends it back to the chrome extension
What's wrong?
When the window of the child app is displayed, the chrome extension is disconnected (it happens exactly at the same time). What follows, the result is not going back to the chrome extension.
What works:
If I omit point no. 2 (just mocking the answer from the child app), the result is returned to the chrome extension.
Including all points: the child app returns it's result correctly. The parent app catches it and tries to return it to the chrome extension (not succeeding, the extension is disconnected)
Also tried
I tried to do it using java multithreading (ExecutorCompletionService, Callable, Future), I wanted to launch the child app in a separate thread and block the main thread until the child is finished, it didn't help.
Solved!
The communication between the chrome extension and my app is through the standard input/output. Somewhere in the code of my app (written in java) there was System.out.println called. It made some mess on STDOUT and made the app disconnect from the extension. It happened in the same time with launching the external app as I saw it, probably didn't happen exactly at the same time, but some time before/after, something the person cannot see.
Multithreading has nothing to do with this problem.
Solution
I found and removed all code writing to standard output

Pwa / Web app "restarts" after Google login

We have a project built in react thats using service worker and manifest for Pwa functions. We use google and facebook to login to the app.
Problem: When running it in Chrome browser (not fullframe) and login to the with eg. google its no problem. When i save it to homescreen and use it in standalone mode (pwa) and hit the our login btn ,google login window opens and i pic an account to login whith. After that the pwa restarts with the splashscreen and im back to where im started Not logged in. Please help
As discussed in this documentation,
When you launch your web app from the home screen a number of things happen behind the scenes:
Chrome launches.
The renderer that displays the page starts up.
Your site loads from the network (or from cache if it has a service
worker).
If you haven't done so, you may want to check Introduction to Service Worker for more information.
With this, you may want to try let the user automatically sign back in to avoid this logging redirect problem.
Additional code reference, see this SO post.

How to write an app that does not open a window in Windows Phone

I want to write an app that just manipulates the content of it's own tile and then silently terminates.
How do I get rid of any default window and splash screen?
Thanks!
You cannot do this fully. Tapping the tile will always launch the app so there will always be a context switch even if it exits immediately.
The closest you can get is to write a Silverlight app and not include a SplashScreenImage.jpg file. When the app starts up immediately exit by calling Application.Terminate (Runtime apps always show their splash screens while loading, but splash screens are optional for Silverlight apps).
This isn't recommended and is likely to confuse your users. A better design would be to let the app launch and do something useful such as displaying more information about what is on the tile or letting the user know what changes are being made.
As Romasz says, this may not pass certification. See Windows and Windows Phone Store Policies for the certification requirements. I suspect an immediate exit with no reason given will appear as and be treated as an app crash.

Problems with HTML application cache in offline mode when the refresh button is clicked

I have a web app developed with application cache. I am testing it on Windows Phone 8.1 running IE 11 mobile. When the internet connection is turned off the web app loads as expected. My problem is that if I hit the refresh button on the browser when the web app is in offline mode the browser tries to check for an updated manifest file. Since there is no connection it cannot find it and then the cache is rendered in an obsolete state and the browser invalidates the cache. The browser refreshes the web app and then tries to pull the page from the network which fails since I am offline. To summarize, what can I do to prevent the browser from invalidating the application cache on refresh when running in offline mode?
That sounds like a bug to me. Per spec, the applicationCache should only be invalidated (become obsolete) if the request to the *.appcache file returns a 404 or a 410 status. If you are offline, it should instead fail with a status of 0.
I'd suggest to test it with other browsers devices and eventually report it as bug to the IE11 team
Not an answer but my reputation isn't high enough to comment, sorry.
Other people have noticed this too (Why offline web application doesn't work?), so as mentioned already here, it looks like a bug.
Are you testing in the 8.1 release that is available from the Developer Preview app? Or a phone running an official release of 8.1?
I ran into the same problem. I haven't got a solution yet. But i want to list what did NOT work!
Adding IIS Mime Types, as discussed here
Changing .manifest to .appcache, as discussed here
Adding the meta header "cache-control: public" as described here
Also did not work to add the header manually in the webbrowser control of the wp 8.1 cordova web app (in the navigate method).
Deleting the Browser History and local storage in windows phone setting is making the problem even worser
Strangely using developer options in IE and change under the tab emulation to windows phone, the appcache loads succesfull
I hope this list will help other people not to find other solutions.

Custom URL and HTTPS in Windows Phone 8

I'm trying to open my app via a custom URL in WP8. I.E, when a link like "myurl://..." is clicked on the browser, it needs to open my app.
Now, when I try to do it from a HTTP link, it works. But when I try to do that from a HTTPS link, I see my app flashing but not a single line of code is processed (not even the "initializeComponent" function of my MainPage.xaml which is, of what I know, the first function to be called when an app is called. So what really happens ? Is there any way to fix this ?
If it can help, I have an SSL certificate for my https page and it is installed on the phone so I don't think it comes from there...