在iframe中嵌入instagram网页 [英] Embebing instagram webpage inside an iframe
本文介绍了在iframe中嵌入instagram网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到此错误:
Refused to display 'http://instagram.com/p/page/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
我想在网络中显示instagram页面,因为它是一个移动应用程序,并且我想使用后退按钮.
I want to show instagram page inside my web because it is a mobile app and I want to use my back buttons.
这是我的网页:
<body id="responsiveDemo">
<div data-role="page" id="test" data-theme="g">
<div data-theme="g" data-role="header">
<a href="javascript:history.back()" data-icon="back" data-iconpos="notext"></a>
<h1>Instagram</h1>
</div>
<div data-role="content">
<iframe id="iframeInstagram" src="" name="IframeInstagram" style="width: 100%; height: 1000px; border: medium none;visibility: visible;"></iframe>
<script>
var query = location.search.substring(1);
//console.log(query);
var parameters = {};
var keyValues = query.split(/&/);
for (var i = 0; i < keyValues.length;i++) {
var keyValuePairs = keyValues[i].split(/==/);
var key = keyValuePairs[0];
var value = keyValuePairs[1];
parameters[key] = value;
}
/*+$(document).ready(function() {
//console.log(parameters['page']);
document.getElementById('iframeColaborador').src = parameters['colaborador'];
});
*/
//$(document).on("pageload", '#test', function() {
$(document).on("pageshow", '#test', function() {
//$(document).load(function() {
console.log(parameters['instagram']);
document.getElementById('iframeInstagram').src = parameters['instagram'];
//document.getElementById('iframeNews').src = 'http://www.unican.es';
});
</script>
</div> <!-- /content -->
我正在使用此网页显示其他网站,但我不知道为什么它在instagram上失败.
I was using this webpage to show others webs but I don't know why it fails with instagram.
推荐答案
是的,您可以显示这种格式的instagram页面
YES, you can display instagram pages with this format
http://instagram.com/p/qbq6fIJMVZ
...在iframe内,只要您添加后缀/embed
...inside iframes as long as you add the suffix /embed
like
<iframe width="320" height="440" src="http://instagram.com/p/qbq6fIJMVZ/embed" frameborder="0"></iframe>
请参见 JSFIDDLE
See JSFIDDLE
这篇关于在iframe中嵌入instagram网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文