Sorry – forgot the code actually made live links in this post. Code without carrots so you can see the actual slashes, etc here:
a href=”http://///SERVER/Inventory/Physical Inventory 2011.xlsx” target=”_blank”>another file</a
*Currently opens to “The page cannot be found”
a href=”http:///\\server/Inventory/Physical Inventory 2011.xlsx”>Test File
*Currently opens to “Server not found”
a href=”file://///SERVER/Inventory/Physical Inventory 2011.xlsx” target=”_blank”>another file</>
*Using “file:” – does not work at all
a href=”file:///\\server/Inventory/Physical Inventory 2011.xlsx”>Test File</a
*Using “file:” – does not work at all
Wondering if adding “file” to the list of protocols might fix my problem, but some of the functions have been deprecated so not sure how to write this now:
$protocols
(array) (optional) An array of acceptable protocols. Defaults to ‘http’, ‘https’, ‘ftp’, ‘ftps’, ‘mailto’, ‘news’, ‘irc’, ‘gopher’, ‘nntp’, ‘feed’, ‘telnet’ if not set.
Default: null
WHAT is the code to add ‘file’ as an accepted protocol and WHERE does the edit happen now that some of these functions have been deprecated?
Getting close?
Try the following
file:///C:/directory/file.extension
C is the drive letter. Also you should make sure that the web server process has access to read such files.
helmpaul,
I’m trying to accomplish the same thing that you’re referencing here. So far, I’m having just limited success.
Interestingly, the code “smb://servername/sharename”, when loaded from a Macintosh accessing my WordPress site in development, works just fine. The Mac Finder presents a display box indicating that the code is searching for the network share in question. It then prompts for AD credentials and upon authentication loads the appropriate network share (or file).
Unfortunately, the “SMB” protocol isn’t supported under Windows 7. Using the syntax “file:///servername/sharename” results in a successful connection to the network share when used in a simple HTML web page, but NOT under the covers of WordPress.
This obviously suggests that there is some protocol setting (such as in your $protocols reference above) that needs to be modified. However, I haven’t been able to find exactly where this code resides.
Were you ever able to solve your problem? If so, would you mind sharing its resolution?
Many thanks.
To open local files on our Intranet, I have solved this as best I can specific instructions for the three browsers used (IE9, Mozilla and Chrome).
We did find that opening file links via the Intranet works easiest when using the Internet Explorer (IE9) browser.
In Mozilla/Firefox, install the Add-on LocalLink: https://addons.mozilla.org/en-US/firefox/addon/locallink/
(NOTE: Once installed, using the Mozilla/Firefox browser and Add-on requires that you RIGHT click on the document links and then select “Open Link in Local Context” to open.)
In Chrome, install the extension “LocalLinks”: https://chrome.google.com/webstore/detail/jllpkdkcdjndhggodimiphkghogcpida?utm_source=gmail
(NOTE: If you have any difficulty opening the link search the Chrome Web Store for LocalLinks WITHIN the Chrome browser and install the extension that way)
Hope that helps!
helmpaul,
Thanks very much for your reply! I’ll try your browser suggestions and see what happens.
Just to be clear, are you also doing anything with the $protocols array to make the Intranet links work?
Also, are you using the “file:///sharename/servername” format? Or are you putting a mapped drive reference in the link, as in the “file:///C:/directory/file.extension” reference above.
I won’t be in a place where I can test these things on my own until next week, so I thought I’d ask you for your thoughts in advance. 🙂
Again, many thanks for your help.
Answers to your final questions:
1) nothing done to $protocols array
2) we use this format for document links:
file://///SERVER/folder/file.extension
Not sure why, but the extra slashes made it work – I had found this after hours of searching the WordPress.org forums/knowledgebase.
Hope that helps.