I have links in my page which says,
<a href='www.mysite.com/ebooks/mybook.pdf'>Mybook</a>
when i click on it, there should be some download confirmation page.
Here is a quick demo how to do that
HTML
<a class="links" href='www.mysite.com/ebooks/mybook.pdf'>Mybook</a>
<br />
<a class="links" href='www.mysite.com/ebooks/mybook.pdf'>Mybook</a>
<br />
<a class="links" href='www.mysite.com/ebooks/mybook.pdf'>Mybook</a>
<br />
<a class="links" href='www.mysite.com/ebooks/mybook.pdf'>Mybook</a>
<br />
<a class="links" href='www.mysite.com/ebooks/mybook.pdf'>Mybook</a>
<div id="modal">
<h3>You are going to download mybook.pdf. Are you sure?</h3>
<button id="yes">Yes</button>
<button id="no">No</button>
</div>
CSS
#modal {
display: none;
margin: 80px;
padding: 20px;
background: #E4E4E4;
text-align: center;
color: #2E3B6F;
}
#modal button {
margin: 0 5px;
}
JS
$(function(){
var link = '';
$(".links").click(function(e){
$("#modal").hide().show("slow");
link = $(this).attr("href");
return false;
});
$("#yes").click(function(e){
if(link) window.location.href = link;
});
$("#no").click(function(e){
$("#modal").hide("slow");
});
});
Live Demo: http://codepen.io/anon/pen/pjrzvB
I used jQuery but you can also made same functionality without jQuery.
Update based on your comment. 10.11.2015