Top

Error sending an image to bubble (IE11) using webSDK

Répondu

Commentaires

7 commentaires

  • Vincent BAILLEAU

    Hi Esben,

    Did you follow the following tutorial:

    https://hub.openrainbow.com/#/documentation/doc/sdk/web/guides/5-Compatibility_with_IE11

    Regards

    0
    Actions pour les commentaires Permalien
  • Esben EHRENSKJOLD

    Yes I have added:

     
     
    I had to add:
    <!--polyfill is a dependency for IE11-->
     
    and 
     
    //Fix for IE11
    if (!String.prototype.startsWith) {
    String.prototype.startsWith=function(searchString, position) {
    position=position||0;
    returnthis.indexOf(searchString, position) ===position;
    };
    }
     
    In order to get the Web SDK to work in IE11
     
    I can do all the following in IE11:
    • Create bubble
    • Add members
    • Send / receive IM
    • Delete bubble
    Only messing adding an image to the bubble
     
    0
    Actions pour les commentaires Permalien
  • Vincent BAILLEAU

    Could you please provide logs on error ?

    tks

    0
    Actions pour les commentaires Permalien
  • Esben EHRENSKJOLD

    I don't think I have more than what I added to the first message:

    Console log:

    %c Mon Aug 13 2018 07:37:01 | RBW-SDK | StorageSrv   | [addFileBub ] ::  Try to add a file https://esben-lt:8010/images/Prisoners_dilemma_diagram.jpg to the bubble 5b712555651f6e68da73de59 color:green

    SCRIPT445: Object doesn't support this action

    rainbow-sdk.min.js (1,724847)

    This line in rainbow-sdk.min.js

    (r.readyState===XMLHttpRequest.DONE){var e=r.response,t=new File([e],i.replace(/^.*[\\\/]/,"")

    0
    Actions pour les commentaires Permalien
  • Vincent BAILLEAU

    Ok,

    Unfortunately, IE11 doesn't support File creator ( see https://developer.mozilla.org/en-US/docs/Web/API/File ), instead using a file path or an URL in the uploadFileToBubble file parameter, use either a File object or a Blob with additional "name" member.

    Regards

    Vincent

    0
    Actions pour les commentaires Permalien
  • Esben EHRENSKJOLD

    Thanks Vincent,

    I got the following to work if anyone else need an example:

    function insertImage(ownedBubble){
    varxhr=newXMLHttpRequest();
    xhr.open("GET", "https://esben-lt:8010/images/Prisoners_dilemma_diagram.jpg");
    xhr.overrideMimeType("image/jpeg");
    xhr.responseType="blob";//force the HTTP response, response-type header to be blob
    xhr.onload=function() {
    varmyFile=blobToFile(xhr.response, "Prisoners_dilemma_diagram.jpg");
    rainbowSDK.fileStorage.uploadFileToBubble(ownedBubble, myFile, "Prisoner's dilemma diagram");
    }
    xhr.send();
    };
    functionblobToFile(theBlob, fileName){
    //A Blob() is almost a File() - it's just missing the two properties below which we will add
    theBlob.lastModifiedDate=newDate();
    theBlob.name=fileName;
    returntheBlob;
    }
     
    Also add the following polyfill to eliminate findIndex error in IE11 after initialising the Web SDK 
    //Fix for IE11 findIndex
    if (!Array.prototype.findIndex) {
    Object.defineProperty(Array.prototype, 'findIndex', {
    value: function(predicate) {
    if (this==null) {
    thrownewTypeError('"this" is null or not defined');
    }
    varo=Object(this);
    varlen=o.length>>>0;
    if (typeofpredicate!=='function') {
    thrownewTypeError('predicate must be a function');
    }
    varthisArg=arguments[1];
    vark=0;
    while (k<len) {
    varkValue=o[k];
    if (predicate.call(thisArg, kValue, k, o)) {
    returnk;
    }
    k++;
    }
    return-1;
    }
    });
    }
     
    Regards, Esben
    0
    Actions pour les commentaires Permalien
  • Vincent BAILLEAU

    Hi Esben,

    happy to see that it works ! Thank you for your contribution. We will try to include this support in one of our next version.

    Regards

    Vincent

    0
    Actions pour les commentaires Permalien

Vous devez vous connecter pour laisser un commentaire.

Vous n'avez pas trouvé ce que vous cherchez?

  • Contactez-nous

    Vous avez des questions? Laissez-nous un message pour obtenir plus d'informations.

    Contactez-nous
  • Demandez à la Communauté

    Vous avez besoin d'aide? Posez vos questions à la Communauté et obtenez des réponses d'autres utilisateurs Rainbow.

    Poster un message