How to open any resource like pdf, image, text file etc., in a IFrame

Hi Experts,

I want to open a file which is located on hard disk in a IFrame. The URL is as follows
"C:\PALogic\pdf\hip new york\yourPlan.GIF", one of the folder contains spaces, here for example "hip new york" contains two spaces. My code is as follows
<html>
<body>
<iframe src="C:\PALogic\pdf\hip new york\yourPlan.GIF" id="pdfFrame" target="_self"/>
</body>
</html>

If i dont have a space in SRC URL its perfectly working fine, but when it contains space iam not able to display any thing.

Please suggest some thing.

Thanks in Advance,
Rave
Ravi Kiran Reddy KatkuriAnalyst ProgrammerAsked:
Who is Participating?
 
hieloConnect With a Mentor Commented:
a url typically starts with a protocol followed by "://" EX:
http:// OR ftp:// or file:///

(No, it's not a typo. The file protocol has three slashes not two).
So yes it should work, but only if accessed from the local machine and if you provide the correct path. In Linux you would not write "c:\... " because there is no such partition on the filesystem.

If you need to put this for people to retrieve from the internet, then no. You would need to set up a webserver and place the file within the webserver space. Additionally, the "file:///" protocol would not apply if served from within a web server.
0
 
hieloCommented:
Try using the "file" protocol:
<iframe src="file:///C:\PALogic\pdf\hip new york\yourPlan.GIF" id="pdfFrame" target="_self"/>
0
 
Ravi Kiran Reddy KatkuriAnalyst ProgrammerAuthor Commented:
HI,
Will this work in linux environment also....because my resource url is in linux machine??

Thanks,
Rave
0
All Courses

From novice to tech pro — start learning today.