Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
171
rated 0 times [  173] [ 2]  / answers: 1 / hits: 37980  / 9 Years ago, fri, october 30, 2015, 12:00:00

I'm trying to open a pdf file using a button in my project.



Given this code:



 <button type=submit class=btn btn-danger onclick= window.open('file:////C:Usersdata'); return true;> PDF </button>


It just opens a about:blank page. What seems to be wrong?


More From » html

 Answers
24

You shouldn't be linking to a local file on your own pc. You need to upload the file to your server, like you would do with images, and then link to the path that you place it in.



You should also be able to use target=_blank for this rather than onclick.
Here is an example set up for the html:



<a href=/books/a-great-book.pdf target=_blank>

[#64558] Tuesday, October 27, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
debra

Total Points: 583
Total Questions: 111
Total Answers: 111

Location: Reunion
Member since Mon, Dec 28, 2020
3 Years ago
;