Link to home
Start Free TrialLog in
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?
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mark
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>
Avatar of Mark

ASKER

Thanks for the help -- and the insight! I'd have never figured that out on my own.
You're welcome, glad to help.  I'm making a note about the symbolic link too.  Hadn't thought of that.