Desean Abraham
Desean Abraham

Reputation: 47

Instafeed JavaScript Issue

So I've downloaded the instafeed.min.js file onto my machine. I am trying to include it in my HTML file and I do so as such:

<script src ="instafeed.min.js", type = "text/javascript">

Which should be correct as both the JavaScript file and my HTML file are both in the same directory. However, when I run this script:

<script type = "text/javascript">
  var feed = new Instafeed({
    get: 'tagged',
    tagName: 'friday',
    clientId: 'bbababfbc6cf42d9bdd731488f99303a'
       });
     feed.run();
</script>

No instagram photos show up on the site. I've followed tutorials and registered a new client via Instagram's Developer website. My question is for the URL needed to register a new client: am I allowed to put in my local host address as the website URL? If not, perhaps that is why my clientId isn't working.

EDIT:: I also used the respective div :

<div id="instafeed"></div>

Upvotes: 1

Views: 1288

Answers (2)

Pedro Casado
Pedro Casado

Reputation: 1745

Did you add the respect div for it?

<div id="instafeed"></div> 

UPDATE:

Looks like Instagram validates the domain you are, so try uploading your files to the production environment.

Another thing, make sure jQuery is loaded. The documentation says that you don't need, but i got some errors without it.

Here's the code:

<html>
    <head>
        <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
        <script src="//cdn.lukej.me/instafeed.js/1.2.0/instafeed.min.js"></script>
        <script>
        $(document).ready(function() {  
            var feed = new Instafeed({
                get: 'tagged',
                tagName: 'cats',
                useHttp: true,
                clientId: 'your-client-id-here '
            });
            feed.run();
          });
        </script>
    </head>

    <body>
        <div id="instafeed"></div>
    </body>
</html>

Upvotes: 0

connexo
connexo

Reputation: 56744

Try

<script src="instafeed.min.js" type="text/javascript"></script>

instead of using <style>.

The <style>-tag is for in-file css rules, not for Javascript. Also, <style> does not have a src-attribute. To include external stylesheets in your html, use

<link rel="stylesheet" type="text/css" href="path/to/my.css" />

Upvotes: 1

Related Questions