0 Favourites

Arrays not downloading as JSON files in IE11

  • Problem Description

    Arrays aren't downloading as JSON files in Internet Explorer 11. All other browsers (tested) will download the JSON file normally.

    Attach a Capx(and attached to this post)

    Description of Capx

    This .capx file is part of a Question Generator which I'm having teachers use to create item banks for assessments.

    Steps to Reproduce Bug

    • Run the .capx file
    • Enter Data in all the fields and hit save (you'll get an error indicating what isn't filled out if something is missed)
    • Tap/Click "Download Question-Pool File"
    • Witness error.

    Observed Result

    Internet Explorer 10 and 11 reply by placing the JSON file into the address bar with a variety of HTML characters (like %, etc...) rather than prompting to download the file.

    Expected Result

    To be prompted to download the JSON file; which happens normally in Firefox and Chrome.

    Affected Browsers

    • Chrome: NO
    • FireFox: NO
    • Internet Explorer (10 and 11): YES

    Operating System and Service Pack

    Win 8.1 Enterprise 64bit (AND Windows 7 SP1 64bit)

    Construct 2 Version ID

    Release 178 (64-bit)

    Troubleshooting Performed and additional information:

    I attempted testing in two environments, the Windows 8.1 with IE11, Chrome, Firefox and Win7 with IE10, Chrome and Firefox. Only IE responds this way which infers that it might be some setting in IE but I've been unlucky at finding anything (actually, my searches have shown people complaining of the opposite: that IE prompts them to download when they want to view the file). Additionally, I reset the browsers to default to try to rule out any odd settings.

    If you're looking at the .capx, the button "Download Question-Pool File" is called "btnDownloadPool" and the code on the event sheet can be found under the group "Button Controls", where the btnDownloadPool "On Clicked" tells the array arrMasterList to "Download as JSON data with filename "questionPool.json".

    Also, this is my first forum post (though I've used the forums much in solving issues before, it's a great resource) so be gentle!

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • The saddest part of this for me is that I *have* to use Internet Explorer because that's what our students and teachers definitely have... [sigh]

  • In the mean time, does the use of the browser object combined with invoke download of string can do the job for you? (Just suggesting so you are not trapped until this get fixed)

  • Interesting, I've never exported JSON from C2, though I am a regular user of IE11. So to simplify your query, the problem line is...

    function 15: "download as JSON data with filename "questionPool.json"

    so I ran your capx and the file I was asked to download was the following. So I hate looking and converting all of this crap to normal text, but to me it seems like this is the correct json file but IE11 is trying to open it with an app, and when it can't, it's trying to parse it as a weblink and failing. If I configured an app to view this, I think it'd behave the same as FIREFOX. Chrome and Firefox see this and interpret it as json and hence you don't see the headers as they strip them out. So I suspect if you could get rid of all the hex encoded text you'd get the file that you wanted.

    JSON is built in IE11 but apparently there are some issues on how the file is configured to ensure it is handled correctly. So it is an issue with IE11 and not C2, and there are fixes for IE11 for this available or so a quick google search suggests.

    you wanted to get

    {"c2array":true,"size":[1,6,3],"data":[[[0,"false","true"],["true",0,"1.1"],[0,0,0],[0,0,0],[0,0,0],[0,0,0]]]}

    and you got

    data:text/html,%3Cp%3E%3Ca%20download%3D'questionPool.json'%20href%3D%22data%3Aapplication%2Fjson%2C%257B%2522c2array%2522%253Atrue%252C%2522size%2522%253A%255B1%252C6%252C3%255D%252C%2522data%2522%253A%255B%255B%255B0%252C%2522false%2522%252C%2522true%2522%255D%252C%255B%2522true%2522%252C0%252C%25221.1%2522%255D%252C%255B0%252C0%252C0%255D%252C%255B0%252C0%252C0%255D%252C%255B0%252C0%252C0%255D%252C%255B0%252C0%252C0%255D%255D%255D%257D%22%3EDownload%20link%3C%2Fa%3E%3C%2Fp%3E

  • Closing, this is not a bug, it's just IE does not support invoking downloads. For the feature to work the browser needs to support the anchor 'download' attribute. Check browser support here. We have a fallback that tries to open a data URL in a new window in order to achieve the same effect, but IE doesn't support that either.

    BTW please always follow the bug report guidelines; you have 97 events, the vast majority of which are unrelated to the actual problem. If the issue wasn't obvious like it was here, I'd have simply closed it without investigation and asked for a minimal example as per the guidelines in order to prove it's not caused by your own events.

  • Aphrodite, rho and Ashley, I'd like to thank you for the replies. Since this was my first report of something I thought was wrong, you guys were great.

    Ashley, I will do that in the future and thanks for investigating anyway. rho and Aphrodite, I appreciate the suggested work around and the very spot on description of the issue I encountered.

    Everything I've seen in the Construct 2 community has been great and I look forward to trying to contribute something rather than just taking in the knowledge of others.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)