Code Monkey home page Code Monkey logo

offline's Issues

Remake ajax requests on restored connection does not happening

When i go offline i see the offline ui message, try to make some requests (getting exceptions in console) and when i connect my internet connection i don't see the ajax requests being remade, although i see the message disappears. Working in Rails/Angularjs environment.

Thanks in advance.

offline.js doesn't work at all

when i include offline.min.js and theme css to my page, and shut down the server, nothing happend when ajax request was failed. what's wrong with it?

How to set Offline.options

I am a newbie, please let me know the code to put after the script to disable requests (false) thanks.

After updating to v0.6.0 issues

HEAD http://[my domain]/offline-test-request/498128607

404 Not Found
36ms

I am constantly getting bombarded with those errors in firebug. Is this intended? IMHO it should not show errors when checking.

offline no longer working

I've updated to the newest version so that I am no longer referencing the cloudfront asset. In the console of all my browsers, I am seeing the request at the specified intervals, but once I disconnect my internet connection, the requests continue without error (and without an OK response as well) so I never see the offline banner. What could be causing this?

Lots of issues

I was very excited to use this, and it seems to have a lot of potential, but there are a lot of small issues:

  • No text message
  • No retry button
  • Doesn't show in FF

Also, the documentation was confusing. Some important things left out, contradictions, etc.

Will come back in a month and check it out though :)

Localizing UI

Can you move localization strings from CSS and JS to one place?
Texts for ui and time before reconnecting now in separate place and this is not comfortably, especially when files not in UTF8 encoding,

Thanks!

Issue with reconnecting

"Your computer lost its internet connection" message stays up after reconnecting to the internet.

this is the options:
Offline.options = {
checks: {
xhr: {url: 'http://google.com'}
},
active: 'xhr'
};

however offlinejs still tries to work with the image approach.

Can I completely override the default check for favicon.ico?

I have the latest version of the library and when the application first loads I'd like it to not check for favicon.ico. Is that possible?

I have reasons for asking this, but it's a side issue and not worth discussing here.

Here's the code pattern I'm using and I would expect this to only use the url I have specified:

        Offline.options = {
            checks: {
                image: {
                    url: function() {
                        return 'http://etc.something.etc/subdir/tiny-image.png?_=' + (Math.floor(Math.random() * 1000000000));
                    }
                },
                active: 'image'
            }
        }

        Offline.check();

Help with turbolinks

Hi

can you please help to get offline work with turbolinks https://github.com/rails/turbolinks/. when i use turbolinks to fetch pages there is no offline-ui class in body tag. i know this could be a problem with how turbolinks work, but is there any work around to get it working.

Thanks

Texts are not modifiable

From an i18n approach texts should be modifiable in config like other parameters, for using in foreign languages. I didn't find the non minimized version to work on, so I made an issue.

WebSockets support

Do you manage to add a WebSockets monitoring in addition to the Ajax monitoring ?

Maybe a proxy in front of the browser websockets API is necessary. Anyway, a «send again the websockets messages» feature would be fantastic.

Only last XHR request being sent

When sending multiple XRH requests during a period of no connection, only the last one is being sent to the flush function. I believe that the requests array being set on line 53 (of requests.js) is being overwritten with each pass of the for loop.

To temporarily fix this on my site, I replaced that line with:

makeRequest(request);

and removed the second for loop from the function (lines 55-58 of requests.js)

Help: after certain time check

Hi, (sorry for english) how to use setTimeout do check internet connection after 45sec and, if connection is up, set window.location.reload(true);, else, recheck after 10sec until connection is up again, and so, reload page.

thanks!

Using in interanet

hi , i want to know can i use this in interanet that havent any internet connection and only have local connections?

Document Check url

By default, it appears to send requests to someones cloudfront endpoint.

It'd probably be good if that configuration option was documented up front so folks know there users will be making requests to an "uncontrolled" domain. I don't see a mention of that behavior anywhere in the README as it stands.

Thank you! This is great.

Unable to avoid remaking requests

I dont want to remake requests which fail while the connection is down. So, I tried to disable the 'requests' option in my application, but i am unable do so.
My code looks like:

<script src="../offline.min.js"></script>
<link rel="stylesheet" href="../themes/offline-theme-chrome.css" />

<script>
Offline.options={
    requests : false,
    checkOnLoad: true,
    interceptRequests: true,
    reconnect: {
        initialDelay: 3,
        delay: 32
    }
}
</script>

I have tried to modify the offline.js and gave requests: false in defaultOptions, then i acheived it.

Can you please help me in doing this?

Strange looping issue with IE9

Hi guys and first of all thanks for this nice script.

Strangely, even tough everything works fine on Chrome, FF, IE10 & IE11, when I try to open my site using IE9 it goes into a reconnecting loop (which starts normally with the disconnected message), downloads the image I've set up fine (IE returns a proper 200 status), but all I get is the attempting to reconnect loop forever. Same goes with the settings I've given and with the default ones.
Unfortunately I'm not a Coffeescript guy so I can't mess with the code, so I'm just asking for ideas here...
I'll try to debug using the compiled JS files (God help me debug on IE). I know that I'll burn in hell or something for even mentioning IE9, but hey... customers still use it, so we gotta play along.

Thanks in advance for any help you can provide.

Make "your connection is lost" last longer

How can I make the first message, that your connection is lost last longer.

I feel that it disappears and moves to the reconnecting message too quickly. It doesn't give the user enough time to read and seems suspicious.

xhr.onprogress is "undefined" in IE + jQuery

I use jQuery to make my AJAX requests, and found that offline.js was not working at all in IE9, yet FF works great.

I tracked it down to line 166 in offline.js: in my case xhr.onprogress was "undefined" as opposed to null. When I added the check for undefined, it works in IE.

Also, it looks like jQuery always sets readyState to "1" before sending the XHR, so the check for 0 on line 175 may not always work. I've seen other examples simply testing for != 4.

Compatibility with angular

I found this strange bug, when I insert the offlinejs lib I get the following error from angular:

illegal access

I think one of the global window methods is causing this, but can't figure out which.

getting offline-test-request http 404 errors

In one of my applications I keep getting the following error right after the application loads. It doesn't seem to affect the library's functionality:

HEAD http://web.local/offline-test-request/330485281 404 (Not Found)

I noticed the error corresponds to this line of code:
https://github.com/HubSpot/offline/blob/master/js/offline.js#L32

Is this a bug? Maybe this is old code from when you hosted the tiny image in the cloud?

Here's my code:

    Offline.options = {
        checks: {
            image: {
                url: function() {
                    return 'http://something.etc.etc/tiny-image.png?_=' + (Math.floor(Math.random() * 1000000000));
                }
            },
            active: 'image'
        }
    }

Https Support

Is there any way to make the request to check the connection through https?

Thank you.

Website download link

Hello,

I downloaded the min file from the main offline.js site, however the link on http://github.hubspot.com/offline/docs/welcome/ links to:

https://raw.github.com/HubSpot/offline/v0.4.4/offline.min.js

Which differs from:

https://raw.github.com/HubSpot/offline/master/offline.min.js

This meant it didn't work as expected and as per the offline.js site when I installed the script i.e. not correctly picking up offline/online window events. Reconnect button not showing (Chrome 30)

Cheers

ability to disable UI

Allow for only the requests handling without any UI indicator.
Expose a config setting to launch a function when the UI would normally change.

bootstrap modal

Hello, i would like, on connection lost, fire a bootstrap 3 modal preventing user to continue. In modal there will be the connection status info.

Is it possible in some way?

Riccardo

{active: 'image'} missing from documentation

If you want to use an image rather than the default offline-test-request url the documentation recommends:

Offline.options = {checks: {image: {url: 'my-image.gif'}}};

If you do that, the image URL is ignored and it just keeps trying the offline-test-request url. You need to add {active: 'image'} for it to work.

By the way, I use /favicon.ico as the image.

javascript error when running with IE9

it looks like IE9 doesn't have document.body initialized when document.readyState === 'interactive'. as a result, the reference to document.body.appendChild in ui.js#render SOMETIMES has a null reference error:

render = function() {
var button, handler;
el = createFromHTML(TEMPLATE);
document.body.appendChild(el);

we fixed it by making this modification in ui.js:
if (((_ref = document.readyState) === 'interactive' || _ref === 'complete' ) && document.body) {
init();

(we understand we'd need to modify the coffeescript to do this properly, but are unfamiliar with the build process/tools at this point.)

if this fix makes sense, let us know and we can submit a proper pull request. if the fix doesn't make sense, an alternate fix or suggestions would be great.

There should be option for sync xhr

I could not find a way to modify this at a runtime. There should definitely be an option to check in synchronous mode, for example, check(true) or something. Therefore it would be possible to use Offline to prevent some user actions while offline.

Consider adding support for PhoneGap

Hi, I like your project. I don't know if you're interested in supporting PhoneGap, but if you are, there are several PhoneGap/Cordova APIs that are available to more reliably determine the state of the network connection:

  • The connection.type property,
  • the online event,
  • the offline event.

Detecting PhoneGap is also quite simple:
if(window.device && window.device.cordova) { ... }

Custom image url does not use cachebreaker

Hi all,
I'm trying to set a custom image URL in the Offline.options. Just to test, I'm using the same cloudfront gif Offline uses, but with https because I host an ssl site.

Offline.options = {checks: {image: {url: 'https://dqakt69vkj09v.cloudfront.net/are-we-online.gif'}}};

The problem seems to be that, with a custom image url, there seems to be no "cachebreaker" query string, while I can see it with the default image url. This makes the browser respond a 304 - not modified and offline.js stops detecting a connection lost.

Please note that the problem is not https. Even with this gif, the cachebreaker is not sent and offline does not work:

Offline.options = {checks: {image: {url: 'http://dqakt69vkj09v.cloudfront.net/are-we-online.gif'}}};

Asynchronous support

Hi,

I'm trying to include this library into my project which uses requirejs to asynchronously download dependencies.

I've noticed that in the ui.coffee file it makes an assumption that the file will be downloaded before the domcontentloaded event is fired.

if document.addEventListener?
   document.addEventListener 'DOMContentLoaded', init, false
else
  # IE8
 _onreadystatechange = document.onreadystatechange
 document.onreadystatechange = ->
     if document.readyState is 'complete'
        init()
_onreadystatechange?(arguments...)

This is not always the case if you downloading your assets asynchronously. Was this is a deliberate design issue? Or would you be happy to change the logic so that it first checks if the DOM has already been loaded?

Default XHR URL should be something that exists

The default URL should be something we know exists, such as an empty HTML file or similar. Error handling is usually much heavier on the web server than serving an existing static file. I'm thinking about exception handling, logging and such, which may cause unnecessary syscalls and complex error routines. Looking for a new filename every time is even worse since it forces an fsync on the server to see if the file exists, circumventing any file caching on the server.

I understand that you try to circumvent client caching with the random filename, but then it's better to include a querystring parameter such as the one used by JQuery: ?_=1382690388689.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.