CODAP › Forums › CODAP Help Forum › Link to CODAP with data/csv included
Tagged: printer
- This topic has 4 replies, 3 voices, and was last updated 5 years, 5 months ago by Anna Fergusson.
-
AuthorPosts
-
Anna FergussonParticipant
I can’t seem to to find how to open up an instance of CODAP with data from a publicly hosted CSV file (including Google sheets published as csvs), e.g. using a link like the one below: http://codap.concord.org/app/?data=http://mywebsite.com/fjdkfjk.csv
I’ve been looking here: https://codap.concord.org/help/data
Where should I be looking for info?
- This topic was modified 5 years, 5 months ago by Anna Fergusson.
July 5, 2019 at 10:05 pm #970Bill FinzerKeymasterHello Anna,
Somewhat unfortunately, the documentation for importing CSV data through the URL is somewhat buried in CODAP’s github site. You can find it here.
There is another gotcha however, namely that CODAP runs as a “secure” site with. As such, the site accessed by the URL parameter must also be secure. So the URL you would use will need to have the ‘https’ prefix as in
http://codap.concord.org/app/?url=https://mywebsite.com/fjdkfjk.csv
Here’s what Jonathan Sandoe has to say in an email to another user:
The issue is that the link is to an insecure http address and CODAP is running with an https URL. Browser rules (quite reasonably) prevent a secure page from loading an insecure file. I tried modifying the URL to “https://xyz.com/Sample.csv” but the server doesn’t appear to support https.
If you are affiliated with the owners of xyz.com in any way you could request that they support HTTPS. It’s probably a good idea for them anyway.
The other network bugaboo that limits CODAP’s ability to read data from a third party sources are same origin policies (CORS). Servers can be configured to restrict the ability of browser apps to read their data. If a CSV file’s server is configured in this way, CODAP will not be able to use it directly.
July 5, 2019 at 10:57 pm #971Anna FergussonParticipantThanks Bill.
Yes, the CORS stuff makes sense. I’m generating the CSVs through my own applications on my websites which fortunately can be “secured”, but these don’t work either e.g.
https://codap.concord.org/app/?url=https://statistics-is-awesome.org/CAS2015_edited.csv
I have no issue using the CSVs in other online tools where a link to CSV can be provided in the URL, so I’m not sure it would be my server settings that are blocking access to CODAP. But I’ll investigate some more!
July 7, 2019 at 2:44 am #972Jonathan SandoeKeymasterHi Anna,
The basic idea of CORS is that the providers of a web resource should be able to control how other sites can use the resource. So, when the browser is asked for a resource that doesn’t have the same origin (server) as the requester, it first checks with the server. You can configure a server to let any origin use a resource or select origins. If you are using an Apache server and wish to let the contents of a directory be used by any origin you would create a file named ‘.htaccess’ in that directory. It should have the following line:
Header set Access-Control-Allow-Origin “*”
You could grant just the CODAP server this access by saying:
Header set Access-Control-Allow-Origin “codap.concord.org”
Jonathan
July 7, 2019 at 4:26 am #973Anna FergussonParticipantThanks so much Jonathan (and Bill) 🙂
I have got this working
https://codap.concord.org/app/?url=https://mathstatic.co.nz/temp/CAS2015_edited.csv
but had to add “https://” on my nginx server (e.g. Access-Control-Allow-Origin: https://codap.concord.org)
Nga mihi
Anna -
AuthorPosts
- The forum ‘CODAP Help Forum’ is closed to new topics and replies.