Macness
Macness

Reputation: 1226

bootstrap button onclick and location.href

Any reason why this wouldn't work?

<button class="btn btn-primary btn-lg" onClick="location.href='http://anothersitehere.com/file.pdf'">Download PDF</button>

Upvotes: 3

Views: 33020

Answers (3)

ashish lalwani
ashish lalwani

Reputation: 21

Leaving location.href blank and in javascript function give

document.location.href='page.php?variable='+value;

it will redirect to the page you want.

Upvotes: 2

Md. Salahuddin
Md. Salahuddin

Reputation: 1072

You would try with this instead

<a class="btn btn-primary btn-lg" href="http://anothersitehere.com/file.pdf">
   Download PDF
</a>

Upvotes: 8

yowza
yowza

Reputation: 260

It's seems that it is working regarding on going to the link. I'm using Chrome btw.

Upvotes: 0

Related Questions