I am creating an application heavily based on javascript that needs that uses at least two APIs. In the main index file I am loading some external javascript files. I want to create random data when the app is offline (as opposed to real data coming from the API) Is there a way to dynamically load a different file locally if there is not an internet connection?
This is one of the scripts that is being loaded.
Btw, the app is going to run on the latest chrome browser version, so there is no need to cater for fallbacks; HTML5 is fine.
<script src="http://www.google.com/uds/api/search/1.0/9d8da27b023599b9c9de8a149abbd171/default+en.I.js" type="text/javascript"></script>