0

In addition to the question here: Open Explorer window from Website

I'm also having trouble with this, especially because I need to integrate a function into the link that eventually will open in file explore.

Bacially, we have a very simple intranet webpage, to control our cases etc.

Each case has some files in in a folder on the server, but to avoid to many subfolders in one folder, we split them in groubs of 200!

\ip\fileserver\cases\"split-folder"\subfolder

I what to open the folder clicking on the case on our webpage.

The split-folder..is defined in ranges with case-numbers for evey 200 cases (sager in danish)

Like this

\25000-25199\25001

\25200-25399\25399

\25400-25599\25422 or 25555 etc . .

The math to calculate the "split-folder" is simple enough with a script but getting this into a link that will open file explore is not that easy.

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction(25555)">Try it</button>

<p id="sagslink"></p>

<script>
function myFunction(sagnr) {
  var a = Math.floor(sagnr/200)*200
  var b = Math.floor(a+199);

  var x = "file://///192.168.15.133/Filserver2016/sager/" + a + '-' + b + "/"+sagnr;
  document.getElementById("sagslink").innerHTML = x;
}
</script>

Simple link that Works in IE..but not in firefox og chrome.

<a href="file://///192.168.1.133\Fileserver2016\sager">sager-full-path</a>

But I can not generate a useful link merging the to!

I have tried evey possible way described here to no awail:

JavaScript function in href vs. onclick

Perhaps I need to revice the function to give the actual link in sted. I also don't what a button but just a generat CASE-Number...that serves as link!

Further more! We mount \\192.168.1.133\Fileserver2016 as Z:

So for our various programs, that use the Z drive path, I would like to open file-explore with the mount path and not the ablosoute path.

We can use IE if nessarry..but I would like i to work on firefox and chrome also

Can this be done!

Sunil Chaudhary
  • 4,481
  • 3
  • 22
  • 41
Tue
  • 1
  • 1
  • I read this twice now, but I'm still not quite sure what the specific issue/question is. Maybe you could clarify, for example by giving a short summary or example? – domsson Jan 16 '20 at 13:59
  • I need to open file explore, by pressing a link on our intranet webpage...not the file structure in the browser. The actual path of the link is generated with the javascript I have pasted, because the folderstructure depends on the case number. We would search up the case in on the webpage..read what the case status is, then open the shared folder, to interact with the actual files, to contienue working on the case. I would like to avoid browsing throgh the files structure..to find the case....and rather just click on the case number...beeing a link to the files in windwos file explore. – Tue Jan 17 '20 at 07:23

1 Answers1

0

Ok. So we got it working...sort of ;O)

Our intranet webpage runs in ASP So the code runs serverside.

Here is the code that works in IE-11.

<%
strSagsNR = rsSag("sagsNR")

Function folderlink(FSagsNR)
a = int(strsagsNR/200)*200
b = int(a+199)
folderlink = "file:///Z:/sager/" & a & "-" & b & "/" & strSagsNR
End Function[enter image description here][1]
%>

To ensure the solution works properly locally and when connected with VPN. It's necessary to add the server ip to IE-11 Internet security - local Intranet - Webplaces - Advanced

as BOTH FILE AND HTTP! See image.

Security setting in IE

Then you should avoid the remark about this file is dangerous and may harm you computer, and File explore will pop up on the correct path ;O)

I have not found any solution for Chrome or Firefox.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Tue
  • 1
  • 1