Solved

Export to CSV Button does not work on Internet Explorer

Posted on 2015-01-27
5
249 Views
Last Modified: 2015-01-28
Hi all,

I have on a number of pages within a web app, code to generate a CSV file and download it via the browser.
This has been working fine, but now it seems to have stopped working in Internet Explorer!

$('#csv_log_export').click(function ()
{
    PopulateCsv();
    var downloadLink = document.createElement("a");
    downloadLink.href = AppViewModel.page_model.csv_data();
    downloadLink.download = AppViewModel.page_model.csv_file_name();
    document.body.appendChild(downloadLink);
    downloadLink.click();
    document.body.removeChild(downloadLink);
});

Open in new window


Any ideas what has changed?

Many thanks,

James
0
Comment
Question by:jatkin
  • 2
  • 2
5 Comments
 
LVL 19

Expert Comment

by:Rikin Shah
ID: 40572499
Hi,

This will not work on IE. You must use any server side code.

You can check with this example. -
Downloadify- http://davidwalsh.name/downloadify

However, you will require flash for this. You need to be careful in case you are designing the page for any tablet. Just check if the tablet supports flash.
0
 
LVL 4

Author Comment

by:jatkin
ID: 40572502
Thanks for the input.
Unfortunately Flash is not an option due to the targeted platforms.
Are there any other options?
0
 
LVL 19

Accepted Solution

by:
Rikin Shah earned 500 total points
ID: 40572511
Server side code instead of JavaScript...
0
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 40572541
Hi,
what kind of Javscript framework are you using?
Can you confirm that the code was run successful prior to a specific date?
Have you tested the functionality in other browsers like Firefox and Chrome?

As it seems that the CSV generation runs only on the client side, perhaps some sort of security update in IE which blocks this type of link generation / execution.

It might also help if you can show the function
PopulateCsv()

Open in new window

as well as what is behind
AppViewModel.page_model.csv_data()

Open in new window

and
AppViewModel.page_model.csv_file_name()

Open in new window


Thanks
Rainer
0
 
LVL 4

Author Closing Comment

by:jatkin
ID: 40575250
Makes a lot of sense to move in this direction for this....
Only a matter of time until the other browsers move in this direction.
Thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn how to dynamically set the form action using jQuery.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now