a have two aspx pages page1.aspx and page2.aspx.
i have an href in page1.aspx <a id="GoHref" href="page2.aspx">
i want that when users click docHref to be redirected to page2.aspx and download a doc file via an automatic click on <a id="DocHref" runat="server">
page2.load is as below:
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
DocHref.HRef="./mydoc.doc";
}
i ‘d like to do do an automatic click on document.ready, something like this:
$(document).ready(function() {
$('#DocHref').trigger('click');
});
But it doesn’t work !!
is this a good way to download a doc file ? Or there a better server side way?
Thanks in advance.
You’re better off using the window .location property than simulating clicks as there is far less overhead.