Instafeed.js出现问题 [英] Trouble with Instafeed.js

查看:59
本文介绍了Instafeed.js出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个基本页面,该页面使用Instafeed.js库显示来自Instagram的照片.我按照本教程进行操作,但是当我打开HTML页面时,仅看到像素化图像,而不是实际图像.

I am just creating a basic page that shows Photos from Instagram using the Instafeed.js library. I followed the tutorial but when I open my HTML page, I just see pixilated images and not the actual images.

打开控制台时,每张照片旁边都出现错误net :: ERR_FILE_NOT_FOUND.

When I open the console, I get the error net::ERR_FILE_NOT_FOUND next to each photo.

这是代码:

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


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


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

推荐答案

如果您是在本地查看HTML页面(在本地,我的意思是您的地址栏以file://开头,则需要将useHttp: true添加到您的设置:

If you are viewing your HTML page locally (and by locally I mean your address bar begins with file://, you will need to add useHttp: true to your settings:

<script type="text/javascript">
  var feed = new Instafeed({
    get: 'tagged',
    tagName: 'awesome',
    clientId: 'Your Client Id',
    useHttp: true   // <--- add this
  });
  feed.run();
</script>


在本地查看文件时,此选项是必需的,因为图像正尝试使用协议相对URL进行加载.如果要在实际的Web服务器上查看HTML文件,则不需要该选项.


This option is required when viewing files locally since the images are trying to load using protocol-relative URLs. If you were to view that HTML file on an actual web server, that option isn't required.

该更改是在版本 1.3 中引入的.

That change was introduced in version 1.3.

这篇关于Instafeed.js出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆