I have near zero html and/or javascript experience and I'm finding so little information on this topic that I suspect I've got a fundamental misunderstanding on what I'm trying to do. But hey, software developers are somehow fungible so this ended up on my plate.
I've got a git project that includes several files. It looks like this: git repo:
I want to publish this on github-pages, which expects the page to be at index.html. When a user does a request to the github-pages url the files that get returned should be based off the request header that the user uses.
For example:
Navigating to the webpage http://my-org.github.io/my-project in a web browser would end up at the index.html file and should be redirected to my_data.html.
curl -H "Accept: application/json" "http://my-org.github.io/my-project" should return the my_data.json
file.
A real nice bonus would be if I could navigate to http://my-org.github.io/my-project.json and get the json file
Redirecting to the my_data.html file by setting up a meta <http-equiv="refresh" content="0; url='./my_data.html'"> seems pretty standard but I can't figure out how to do the json part. Most tutorials specify what content negototiation is but then get all hand-wavey at the implementation or refer to API frameworks that have it all baked in.
Is there some kind of javascript if statement I could use to handle the TWO mime-types I expect to handle?