function browserRequest(url, sync, callback) {
    sync = sync === false ? false : true;
    callback = typeof callback === "function" ? callback : function () {};
    var result = undefined;

    var xhr = function xhr(url, sync, callback) {
      var request = new XMLHttpRequest();
      var i = 0;

      var sanitizeUnicode = function sanitizeUnicode(data) {
        var dataLength = data.length;
        var charArray = [];
        var StringFromCharCode = String.fromCharCode; //Transform Unicode to ASCII

        for (i = 0; i < dataLength; i += 1) {
          charArray.push(StringFromCharCode(data.charCodeAt(i) & 0xff));
        }

        return charArray.join("");
      };

      request.open("GET", url, !sync); // XHR binary charset opt by Marcus Granado 2006 [http://mgran.blogspot.com]

      request.overrideMimeType("text/plain; charset=x-user-defined");

      if (sync === false) {
        request.onload = function () {
          if (request.status === 200) {
            callback(sanitizeUnicode(this.responseText));
          } else {
            callback(undefined);
          }
        };
      }

      request.send(null);

      if (sync && request.status === 200) {
        return sanitizeUnicode(request.responseText);
      }
    };

    try {
      result = xhr(url, sync, callback); // eslint-disable-next-line no-empty
    } catch (e) {}

    return result;
  }
@name loadImageFile
@function
@param {string} path
@param {boolean} sync
@param {function} callback