Click here to Skip to main content
15,903,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I want to display the file from a path using javascript. Can any one please help me.

I want to get the full path of the document

Iframe id = ifDisplay
buttonid = btnValue
Application Path = D:\MRS\
file path = E:\MRS\Uploads\

i want to display the pdf files from E Drive in iframe.

What I have tried:

1. var path = document.getElementById('ifDisplay').src = '..\\Uploads\\' + btnValue + '.pdf';

2. var path = document.getElementById('ifDisplay').src = '../Uploads/' + btnValue + '.pdf';
Posted
Updated 15-Mar-17 20:31pm

1 solution

Please follow the link , it might help you.
Use "file:///" before giving your absolute path.
Also, be careful while giving forward & backward slashes.

Below is the working code in my local system.
HTML
<iframe src="file:///C:\Users\105800\Downloads\Systems - Casinolink - Slot.pdf" style="height:700px; width:500px;" frameborder="0.3"></iframe>


Hope, it helps.
Thanks.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900