最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - is there any alternative to < object > tag in google chrome? - Stack Overflow

programmeradmin4浏览0评论

is there any alternative to < object > tag in google chrome?

<div id="topBar">
<a href ="#" onclick="load_home()"> HOME </a>
</div>
<div id ="content"></div>

Javascript:

function load_home(){
document.getElementById("content").innerHTML='<object type="type/html" data="home.html" ></object>';
}

it works fine on firefox but not in google chorme. why? any solution? it shows "no plug-in available to display this content". now my question is how to available plug-in to display the html page?

is there any alternative to < object > tag in google chrome?

<div id="topBar">
<a href ="#" onclick="load_home()"> HOME </a>
</div>
<div id ="content"></div>

Javascript:

function load_home(){
document.getElementById("content").innerHTML='<object type="type/html" data="home.html" ></object>';
}

it works fine on firefox but not in google chorme. why? any solution? it shows "no plug-in available to display this content". now my question is how to available plug-in to display the html page?

Share Improve this question edited Jul 14, 2013 at 7:50 Giliweed asked Jul 14, 2013 at 6:53 GiliweedGiliweed 5,1778 gold badges30 silver badges35 bronze badges 3
  • 2 This is what <iframe> elements are for. – Blender Commented Jul 14, 2013 at 6:54
  • 3 You've got type="type/html" That should be type="text/html" Then it will work fine in Chrome. – Alohci Commented Jul 14, 2013 at 10:06
  • wow! thanks thanks thanks! you are right! it wooooorkkksssss :). this code drove me crazy all day. I was dying to find the solution. Thank you so much. Such a silly mistake I hardly noticed! Now finally I can finish my project work. :) @Alohci – Giliweed Commented Jul 14, 2013 at 18:52
Add a ment  | 

1 Answer 1

Reset to default 5

Use an iframe instead of the <object> tag. <object> tags do not reliably work cross-browser, and are mostly used for Flash and sometimes Java applets. See here for more on iframes.

发布评论

评论列表(0)

  1. 暂无评论