Avatar of Mark
Mark
 asked on

howto reference a file from a URL

I want a user to be able to load a file directly from his own drives. I have a button as follows:

<button type=button onclick="location='X:/Archives/Pension Files/SMITH, PATRICK T.pdf'">Click me</button>

Clicking this button gives me a javascript error: Access denied.

I've tried various variations on this theme:

<button type=button onclick="location='FILE:///X:/Archives/Pension Files/SMITH, PATRICK T.pdf'">Click me</button>

<button type=button onclick="location='FILE:///X|/Archives/Pension Files/SMITH, PATRICK T.pdf'">Click me</button>

even:

<button type=button onclick="window.open('X:/Archives/Pension Files/SMITH, PATRICK T.pdf','_BLANK','')">Click me</button>

All give me the same error. This user can open this file using Windows explorer, so I don't think it is a "real" permission issue.

The test html is running under tomcat.

What is my problem?
HTMLJSP

Avatar of undefined
Last Comment
Dave Baldwin

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Dave Baldwin

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Mark

ASKER
Wowser! I didn't know all that. the HTA solution looks interesting, but non-trivial. Plus there's that limitation to using IE. I decided to take a different route.

My desired target folder is on a Network Accessible Storage drive already samba mounted on the Linux webserver. So, I just created a symbolic link from my tomcat folder "documents" to the samba folder and I'm done! Script that works:

<button type=button onclick="window.open('documents/Pension Files/SMITH, PATRICK T.pdf','_BLANK','')">Click me</button>
Mark

ASKER
Thanks for the help -- and the insight! I'd have never figured that out on my own.
Dave Baldwin

You're welcome, glad to help.  I'm making a note about the symbolic link too.  Hadn't thought of that.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck