Reputation: 19
I have created a download button , which will download a .xlsx file. The same is working perfectly in chrome , but not doing anything in IE and Firefox. I donot able to understand the exact problem here .
<nav class="navbar navbar-inverse visible-xs">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div><br/><br/><br/></div><br/>
<div align="center">
<div class="panel panel-default">
<div class="panel-heading">
<h3><?php echo $dirname; ?> Cities Charts <?php echo $project; ?></h3><button class="col-sm-offset-11 btn btn-success"><a href="/NT_Dashboard_withDB/Dashboard_Additional_Information.xlsx" download>Download Data</a></button></div></br></br>
<div id="bodyContent" class="panel-body"></div></br></br>
</div>
</div>
Upvotes: 0
Views: 139
Reputation: 1
Instead of using "button" tag to wrap "a" tag you can style tag as shown below.
<div class="panel-heading">
<h3><?php echo $dirname; ?> Cities Charts <?php echo $project; ?></h3>
<a href="/NT_Dashboard_withDB/Dashboard_Additional_Information.xlsx" class="col-sm-offset-11 btn btn-success" download>Download Data</a>
</div>
This will work for you.
Upvotes: 0
Reputation: 1413
according to HTML syntax button
cannot have <a>
tag inside of it.
to solve your problem you can use <a >
outside button or use javascript
<a href="/NT_Dashboard_withDB/Dashboard_Additional_Information.xlsx" download>Download Data<button class="col-sm-offset-11 btn btn-success"></button></a>
javascript:
<button class="col-sm-offset-11 btn btn-success" onClick="javascript:window.location='/NT_Dashboard_withDB/Dashboard_Additional_Information.xlsx'></button>
Upvotes: 2
Reputation: 6088
The problem is support for the HTML5 download
attribute. IE doesn't support it and older versions of Firefox may not support it either.
https://caniuse.com/#search=download
Upvotes: 1