Giter Club home page Giter Club logo

Comments (8)

Acconut avatar Acconut commented on May 29, 2024

Intentionally, isSupported may be true even if local storage is not available. The reason is that it should indicate whether tus-js-client can upload at all which requires file slicing and support for XHR but no Web Storage. If you are interested in whether it is able to store URLs in the local storage, you have to examine canStoreURLs (see https://github.com/tus/tus-js-client#tuscanstoreurls).

from tus-js-client.

mmathys avatar mmathys commented on May 29, 2024

I see, I wasn't aware of canStoreURLs.

However I'm not sure the private mode on Safari on iOS really sets the canStoreURLs to false: if I'm not mistaken, tus is only checking whether the local storage exists, but not whether it's accepting any values.

Local storage exists in private mode, but it's not accepting any values and throws a QuotaExceededError when attempting to actually save values, see this thread. It's a strange behaviour.

from tus-js-client.

mmathys avatar mmathys commented on May 29, 2024

The modernizr's approach handles this issue.

function lsTest () {
  var test = 'test';
  try {
    localStorage.setItem(test, test);
    localStorage.removeItem(test);
    return true;
  } catch(e) {
    return false;
  }
}

if (lsTest () === true) {
    // available
} else {
    // unavailable
}

from tus-js-client.

Acconut avatar Acconut commented on May 29, 2024

However I'm not sure the private mode on Safari on iOS really sets the canStoreURLs to false: if I'm not mistaken, tus is only checking whether the local storage exists, but not whether it's accepting any values.

In the past, this check has served us well in detecting whether local storage is usable, as accessing the length of it is usually not permitted if the entire Web Storage is unavailable. However, this may not be the case in Safari's private mode. I will take a look at it but this may take some time as I do not have an iOS device at hand.

from tus-js-client.

mmathys avatar mmathys commented on May 29, 2024

@Acconut If you like you can assign this issue to me, I'm working on a project right now which involves tus and iOS devices. As far as my company is concerned, working on tus is considered as working on the product.

from tus-js-client.

Acconut avatar Acconut commented on May 29, 2024

@mmathys That would be very helpful if you could look into this. Thank you and your company already in advance.

from tus-js-client.

Acconut avatar Acconut commented on May 29, 2024

Closing in favor of #53.

from tus-js-client.

Acconut avatar Acconut commented on May 29, 2024

The according patch is available in v1.4.2.

from tus-js-client.

Related Issues (20)

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.