Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 536
  • Last Modified:

Using javascript to make a pop-up dialog when page loads

I'm using a web application (using ColdFusion 9) to create  an excel file to give to the user to download.  When the page reloads the following is run

window.location.href = '#application.settings.absoluteURL#modules/#url.name#/excel/#fileName#';

This exectedly creates a dialog where the user can "save-as" the file.  However, this makes javascript on the page break (including some jquery items).  Is there an alternative javascript call to prompt a user with "save-as" dialog WHEN th epage loads.  Would prefer to not have to have them press a link.

1 Solution
so the user clicks a link and the page reloads?  since you're already using jquery, what about triggering the download from the initial link? I haven't used it, but here's one example using the jqueryfiledownload plugin

//With jquery.fileDownload.js
//bare-bones stock setup
$(document).on("click", "a.fileDownloadStock", function () {
    var linkHref = $(this).attr('href');
    return false; //this is critical to stop the click event which will trigger a normal file download!

Open in new window

HyperBPPAuthor Commented:

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now