1

I'm a new web developer working on a small project involving the Box API. After struggling for about a week trying to create my own code to authenticate a user, I decided to consult the Javascript SDK created by Box (https://github.com/box/box-javascript-sdk). However, when I open the "sampleUpload.html" file using localhost, I cannot click the "Click here to get an auth token" header. Looking at the html code, it seems that the page is styled to change the cursor to a pointer when hovering over the text, but no actual code is triggered when clicking on it.

Is there a way I can change the code to make the page work as intended? Thank you so much for reading this, I really appreciate any help you guys can give.

1
  • See my answer, but adding a comment for a "best practice" as a new web developer. You need a web server on your development machine to properly debug code, as issues like this will have you chasing your tail wasting time. Even a server that just serves static html will work most of the time. Commented May 3, 2013 at 19:17

2 Answers 2

1

Running on Localhost, you'll need to make sure your paths are properly configured. For instance, with the file open in your browser, right click and "view source", the at the bottom, try to open one of the JavaScript files. If it won't open, that's your problem. Adding / to the front of all the paths to files referenced in html will usually make it work from localhost.

Sign up to request clarification or add additional context in comments.

4 Comments

Sorry for the delayed response--When I look at the source of the file and open one of the .js files, it opens as text in my browser. If I try to append a "/" after, it returns a 404 error: The requested URL /boxproject/box-javascript-sdk-master/js/goessner.xmlToJson.js/ was not found on this server. I'm not sure if this means my path isn't configured or if it means localhost doesn't recognize the .js file. Also could you elaborate more regarding your comment up top? How would I configure my web server to debug code. Thanks so much for the help.
I was just referring to using a local web serer to serve your files vs. opening them from the file system. You didn't say what OS, so I can't give you much advice.
I downloaded the javascript SDK sample you referenced, and it's garbage. It's not even the slightest bit functional, I have no idea why they would even upload it. You might open an issue on Github against it, or try to find a more complete example.
OK gotcha, thanks again for the help, I really appreciate it.
0

I was able to get this API working successfully by combining with the methods described here. ( http://developers.blog.box.com/2011/09/28/using-the-box-api-with-javascript )

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.