Cross Origin in ajax not working for .properties file in IOS (10.3.1)

I used i18n plugin for load *.properties file for translation and its working fine on android platform but same library not working on IOS 10.3.1. It gives me below error:

enter image description here

i have done some changes in i18n library but still its not working.

function loadAndParseFile(filename, settings) {
        url: filename,
        async: false,
        cache: settings.cache,
        crossDomain: true,
        jsonpCallback: 'callback',
        contentType: 'text/plain;charset=" + settings.encoding,
        dataType: "text',
        success: function (data, status) {
            parseData(data, settings.mode);

In above code:

i have been added Cross-Domain ‘true’ and datatype ‘text’.. when i changed datatype ‘text’ to ‘jsonp’ its working but it gives .properties file error.
Please check below error..

enter image description here

That means. file is loaded, but inner data format is different.

If you are using now JSONP instead of text, the file will be loaded as javascript code, so if contents are not valid javascript code it will fail.

Surround data with a global variable assignation or a function call:

    window.variable = "_DATA_"; // or

If _DATA_ are JSON format, then you don’t need surround with quotes, otherwise you’ll need to use “_DATA_” because without quotes it will not be valid javascript syntax.

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .
Read More:   Sublime Text 2: Auto fix indentation for javascript?

Similar Posts