JavaScript redirect to local file

Currently there is an application running that was written in house. In the application there is a JavaScript redirect that will open a PDF file off the local machine, the code is below.

The code worked great on all platforms until XP SP2 came along and then it stopped working and we get a "page cannot be displayed" error. We have tried turning off the pop-up blocker and that wasn't it, so any help would be appreciated.

Can anyoen help with what setting we need to change in IE to get this to work again? Here is the code.

/**
 * buildMidwestActivityReportLinkUrl
 *
 * JavaScript function that builds the Midwest Activity Report link URL with the
 * parameters required for the servlet.
 *
 * Author: Janardan Kortikere
 */
 
function buildMidwestActivityReportLinkUrl()
{
      var sortDirectionsList = document.midwestActivitySortFilterForm.sortDirectionsList.value;
      var hiddenFilterProjectStatusId = document.midwestActivitySortFilterForm.hiddenFilterProjectStatusId.value;
      var hiddenFilterBuildingCode = document.midwestActivitySortFilterForm.hiddenFilterBuildingCode.value;
      var filterDoneByDateFromOffset = document.midwestActivitySortFilterForm.filterDoneByDateFromOffset.value;
      var filterDoneByDateToOffset = document.midwestActivitySortFilterForm.filterDoneByDateToOffset.value;
      var filterDoneByTimeFrom = document.midwestActivitySortFilterForm.filterDoneByTimeFrom.value;
      var filterDoneByTimeTo = document.midwestActivitySortFilterForm.filterDoneByTimeTo.value;

      var midwestActivityReportLink =
            '<%= UrlBuilder.getServletRoot() %><%= ApplicationConstants.SERVLET_PRINT_MIDWEST_ACTIVITY_REPORT %>'
            + '?<%= ApplicationConstants.ACTION %>=<%= ApplicationConstants.ACTION_PREVIEW %>'
            + '&sortDirectionsList=' + sortDirectionsList
            + '&hiddenFilterProjectStatusId=' + hiddenFilterProjectStatusId
            + '&hiddenFilterBuildingCode=' + hiddenFilterBuildingCode
            + '&filterDoneByDateFromOffset=' + filterDoneByDateFromOffset
            + '&filterDoneByDateToOffset=' + filterDoneByDateToOffset
            + '&filterDoneByTimeFrom=' + filterDoneByTimeFrom
            + '&filterDoneByTimeTo=' + filterDoneByTimeTo
            + '&sortField1=' + document.midwestActivitySortFilterForm.sortField1.value
            + '&sortField2=' + document.midwestActivitySortFilterForm.sortField2.value
            + '&sortField3=' + document.midwestActivitySortFilterForm.sortField3.value
            + '&sortField4=' + document.midwestActivitySortFilterForm.sortField4.value
            + '&sortField5=' + document.midwestActivitySortFilterForm.sortField5.value;
      return midwestActivityReportLink;
}
/**
 * showMidwestActivityReportInNewWindow
 *
 * JavaScript function that displays the Midwest Activity Report in a new window.
 *
 * Author: Janardan Kortikere
 */
 
function showMidwestActivityReportInNewWindow()
{
      midwestActivityReportWin=window.open("",                   
            'midwestActivityReportWin',toolbar=0,scrollbars=1,location=0,status=0,menubar=0,resizable=1,width=975,height=700,left=0,top=0');
      midwestActivityReportWin.document.write("<head><title>Midwest Activity Report<\/title><\/head>");
      midwestActivityReportWin.document.write('<h1>' + 'Retrieving report data .... please wait' + '</h1>');
      newURL=buildMidwestActivityReportLinkUrl();
      setTimeout('midwestActivityReportWin.location.href=newURL;', 1000);      
}
mt_100Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RoonaanCommented:
This is because the file:// domain is another domain than the http:// domain. Therefor SP2 does not allow you to change a "online" document to "local" href.

A solution is to have a frame/window with href file:// and then change it using javascript:

<iframe src="file://" id="midwestActivityReportWin"></iframe>

midwestActivityReportWin.location.href = "file://localfile";

Regards, and goodluch,

-r-
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.