I have some very basic RequireJs code that fetches an html file with simple html. In Firefox 8.0 it works fine, however in my build of Chrome (17.0.9.xxx) I get the following error:
Cross origin requests are only supported for HTTP.
Could this just be a problem with this build of Chrome or the text plugin in general?
define([
'jquery',
'backbone',
'text!templates/home/listOfStuff.html'
], function ($, Backbone, mainTemplate) {
var mainView = Backbone.View.extend({
el: $('#list'),
render: function () {
this.el.html(mainTemplate);
}
});
// return the view object
return new mainView;
});
When Require attempts to fetch the html file is when the error occurs.
It's chrome's local file system access policy. For local development you could just add following flags:
--allow-file-access-from-files --disable-web-security
I agree with ProTom there, if you set up a webserver to serve up your html pages you should be all set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With