I can't seem to download the pdf here. It just goes to a different window instead of downloading automatically. How do I save the PDF as a file instead of opening to a new window? Here's my code:
<p>
<select id="scripts" name="scripts">
<option disabled selected>Select to Download</option>
<option value="http://concentrix.kinsta.cloud/wp-content/uploads/2020/12/CULTURE_symbolisms_bw_2018_AB_ver01_r01_09082020_us.pdf">Save as PDF</option>
<option value="http://concentrix.kinsta.cloud/wp-content/uploads/2020/12/CULTURESTATEMENTS.zip">Save as JPG</option>
</select>
</p>
<p style="text-align:center;">
<input type="button" id="showVal" value="Download" />
</p>
<script>
(function() {
var sel = document.getElementById('scripts');
function getSelectedOption(sel) {
var opt;
for (var i = 0, len = sel.options.length; i < len; i++) {
opt = sel.options[i];
if (opt.selected === true) {
break;
}
}
return opt;
}
document.getElementById('showVal').onclick = function() {
window.location = sel.value;
}
}());
</script>
Thanks for the help!