In Javascript, I tried to use XMLHTTPRequest to access a public github repository file (and convert the string in the file into some js object that I can use later), which works perfectly okay on my terminal using Node; however, it keeps returning a status of 0 (in instead of 200) when I implemented it in Qualtrics.
My guess is because it’s a cross-domain operation. And I found an instruction page on Qualtrics support that walks you through using SFTP.
Does anyone have experience with this or some advice as into what to do in this scenario?
Page 1 / 1
Yes, your issue is likely related to cross-origin resource sharing (CORS) restrictions. When you try to access a resource from a different origin (domain) in a web browser, CORS policies can block your request if the server doesn't explicitly allow it.
For accessing public GitHub files in a web environment like Qualtrics, using the GitHub API with appropriate headers is the recommended approach.
Yes, your issue is likely related to cross-origin resource sharing (CORS) restrictions. When you try to access a resource from a different origin (domain) in a web browser, CORS policies can block your request if the server doesn't explicitly allow it.
For accessing public GitHub files in a web environment like Qualtrics, using the GitHub API with appropriate headers is the recommended approach.
I tried to use the github javascript api package octokit, which works on my terminal again. But does anyone know how I would be able to import this package to Qualtrics?
@CindyJ Since you can't use Node.js style imports directly in Qualtrics, you'll need to include the Octokit library using a script tag. You can add external scripts in the Qualtrics survey using the header or footer sections or directly in the question HTML.
If you encounter CORS issues, ensure your GitHub repository is public. Private repositories require authentication, and you should include a personal access token.
@CindyJ Since you can't use Node.js style imports directly in Qualtrics, you'll need to include the Octokit library using a script tag. You can add external scripts in the Qualtrics survey using the header or footer sections or directly in the question HTML.
If you encounter CORS issues, ensure your GitHub repository is public. Private repositories require authentication, and you should include a personal access token.
So sorry for the mass questions!! I just want to see if you could briefly check for me if there’s I have any major misunderstanding of what I should be doing: