Soundcloud API Error NS_ERROR_DOM_BAD_URI: Access to restricted URI denied (JavaScript)

Viewed 8803

I am just getting myself acquainted with Soundcloud's API and I am having some trouble. As far as I can tell, all I need in SC.initialize is a client_id. I have used the tutorials at Code Academy to get started and it was great. Now that I am actually trying to implement something I am running into some trouble.
When I ran my code in Code Academy, it did exactly what I wanted it to do. Now that I am trying to run it in a browser, I am getting a blank screen and this error:

NS_ERROR_DOM_BAD_URI: Access to restricted URI denied @ http://connect.soundcloud.com/sdk

After doing some research, I have found that those errors are related to domain prefixes. So I tried changing it to http://www.connect.soundcloud.com/sdk. But when I do that, I get a different error:

SC is not defined

AHHHH What am I doing wrong?!
I am new to using API's, and any help at all would be very greatly appreciated.
Here is what I am doing:
(JavaScript)

SC.initialize({
    client_id: 'hidden for privacy',
});

$(document).ready(function() {
    SC.get('/users/5577686/tracks', {limit:7}, function(tracks) {
        $(tracks).each(function(index, track) {
            $('#tracktitle').append($('<li></li>').html(track.title));
            $('#trackimage').append("<img src='" + track.artwork_url + "' />");
            $('#play').append("<a href='" + track.permalink_url + "' >" + "Play" + "</a>");
        });
    });
});

(HTML)

<!DOCTYPE HTML>
<html>
    <head>
        <script src="http://connect.soundcloud.com/sdk.js"></script>
        <script src="soundcloud.js"></script>
    </head>
    <body>
        <div id="tracktitle"></div>
        <div id="trackimage"></div>
        <div id="play"></div>
    </body>
</html>

I don't really think there is anything wrong with the code, as everything seemed to be working fine in Code Academy. I think it is more of an issue with familiarizing myself with the API. Do I need to do some further authentication? Do I need something more than just the client ID? Again I am very stuck and would appreciate any amount of help on this. Thanks for reading.

(I also followed along with Coding for GOOD's Soundcloud API Integration tutorial step-by-step and I am getting the same exact errors, so this further confirms that the code is probably not the problem, but connecting to the API may be)

1 Answers
Related