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

javascript - IFrame does not work for local sources? HTML - Stack Overflow

programmeradmin0浏览0评论

Does IFrame works for local directory? I'm trying to embed excel into my HTML but nothing shows up. I have tried many ways to put in my local directory but it remains the same.

<iframe src="file://C:\Documents and Settings\username\Desktop\hi.xls" width="98" height="120" frameborder="0" scrolling="no"></iframe>

The end result have been an empty box.

Does IFrame works for local directory? I'm trying to embed excel into my HTML but nothing shows up. I have tried many ways to put in my local directory but it remains the same.

<iframe src="file://C:\Documents and Settings\username\Desktop\hi.xls" width="98" height="120" frameborder="0" scrolling="no"></iframe>

The end result have been an empty box.

Share Improve this question edited Sep 3, 2015 at 2:08 Mogsdad 45.8k21 gold badges163 silver badges286 bronze badges asked Dec 26, 2014 at 7:03 De De De DeDe De De De 4263 gold badges11 silver badges31 bronze badges 5
  • Don't use local path when you create any web application.. – Anant Dabhi Commented Dec 26, 2014 at 7:05
  • @AnantDabhi Just trying to test it out whether it works. – De De De De Commented Dec 26, 2014 at 7:06
  • better place your file in the same folder and just give the path from that folder........... suppose like........................ <iframe src="files/hi.xls">... It would be better than giving all the path from C:\Documents and Settings........................ – annam priyatam Commented Dec 26, 2014 at 7:08
  • @annampriyatam I have to use the full directory because of the development at the later stage. Using ColdFusion, I'm actually storing the excel files in GetTempDirectory(), a coldfusion function which returns the full directory path. – De De De De Commented Dec 26, 2014 at 7:14
  • oh okk.. then i think may be due to the slashes.. Here you have // in file:// and in the rest of the path you have \.. am not sure that it'll work.. but just give a try... – annam priyatam Commented Dec 26, 2014 at 7:18
Add a ment  | 

1 Answer 1

Reset to default 3

you can't add I-frame with local file src All modern browsers prevent display of "local" files using the file protocol in iframes for security reasons.

check your browser console... if you get message like it means your browser prevent load local resource to Iframe

Not allowed to load local resource

发布评论

评论列表(0)

  1. 暂无评论