heb12 / heb12-electron

A simple Electron app for reading the Bible
https://heb12.github.io/desktop
GNU General Public License v3.0
10 stars 7 forks source link

Error with Custom Require function #4

Closed MasterOfTheTiger closed 6 years ago

MasterOfTheTiger commented 6 years ago

I get this error in the console when the custom require script runs: Failed to load file:///home/USERNAME/heb12/app/bible/Hebrews.json: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

This is the code:

$.noConflict
            function require(url) {
                var rtrn
             jQuery.ajax({async:false,url: url, success: function(result){
                if(url.search(".json")!==-1) {rtrn= JSON.parse(result);} else if(url.search(".js")!==-1) {rtrn= eval("function() {"+result+"}");} else {
            rtrn= result;
                }
        }});return rtrn;
            }
MasterOfTheTiger commented 6 years ago

@amazinigmech2418 You need to look at it. We may need a different function.

AmazingMech2418 commented 6 years ago

@MasterOfTheTiger That's just an API error. It can't load json files in a local system.

MasterOfTheTiger commented 6 years ago

So it will work on gh-pages?