Skip to content

atob function failing in IE11 and pre-Chromium Edge #2901

@LordGalahad

Description

@LordGalahad

It seems that I cannot load custom fonts in IE11 or pre-Chromium Edge.

My Project selects a font file and then converts it into a Base64 string

I have no problems running this into Chrome or FireFox.

But when it came to IE11 or old Edge, I get that PubSub error with an invalid calling object details.

I tried to debug and and ended up here

image

atob was returning an invalid calling object error (does not happen in Chrome or Firefox)

A workaround I did was instead of fetching the font into a Blob and using a FileReader to get the Base64 string of the font. I used arrayBuffer and just use this:

let fontData = new Uint8Array(content).reduce((data,byte)=>(data.push(String.fromCharCode(byte)),data),[]).join('');

It worked, and then I remembered I also had a lot of images in Base64 string that resulted in Corrupted PNG.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions