Suggestion: Move the data.js file load out of c2runtime.js

Discussion and feedback on Construct 2

Post » Sat Jan 09, 2016 11:50 pm

@Ashley Or whoever else programs the HTML5 exporter for C2:

Would it be possible to move the data.js (or data.json) file call out of the c2runtime.js file, or possibly load it from the configurable "Project Files" directory in the export options?

Due to the security proxy system that I am using, I have to update the block of code in the c2runtime.js file that loads that file every time I export our project. This isn't exactly a high priority, just more a nuisance that I wanted to make you aware of... a nice-to-have.

These are the lines of code that I have to modify:
Code: Select all
Runtime.prototype.requestProjectData = function ()
   {
      var self = this;
      var xhr;
      if (this.isWindowsPhone8)
         xhr = new ActiveXObject("Microsoft.XMLHTTP");
      else
         xhr = new XMLHttpRequest();
      var datajs_filename = "/res/data.js";
      if (this.isWindows8App || this.isWindowsPhone8 || this.isWindowsPhone81)
         datajs_filename = "/res/data.json";
      xhr.open("GET", datajs_filename, true);
      var supportsJsonResponse = false;


from a raw "data.js" / "data.json" to pointing it to the Project Files resources directory at "/res/*"

Not high priority, but this would be a nice-to-have.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,347
Reputation: 4,688

Post » Mon Jan 11, 2016 1:01 pm

Isn't this just because your proxy is mis-configured? If the runtime can't load data.js by default, then presumably other AJAX requests will fail for the same reason, and possibly images, audio and video will fail to load too.
Scirra Founder
B
381
S
222
G
84
Posts: 23,980
Reputation: 189,190

Post » Tue Jan 12, 2016 5:14 pm

Well, yes, and no. I can get around this, but it is annoying to have to have a specific proxy entry for this file. That is why I say it's not high priority, just a nice-to-have.

EDIT: Actually let me explain in a bit greater detail:

We are running two separate Construct2 projects (one for the website, one for the client) on the same domain and we cannot have two entries pointing to the same file, because they are not the same file. This is primarily why I am asking that it be tied to the resources directory, as that would allow me to configure it in the export options without having to go and modify either the website export code or the client export code.

Either way though, thanks for your work, and we are anxiously awaiting C3. We are setting aside funds right now to buy several licenses of the ultimate version of C3.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,347
Reputation: 4,688


Return to Construct 2 General

Who is online

Users browsing this forum: tetuan and 4 guests