t4t5 / sweetalert

A beautiful replacement for JavaScript's "alert"
https://sweetalert.js.org
MIT License
22.39k stars 2.84k forks source link

How to Add Link in this code ? #871

Closed Ok9xNirab closed 5 years ago

Ok9xNirab commented 5 years ago

Hi, Here is my javascript code ......I can't add link in "ok" button;

``

t4t5 commented 5 years ago

You can use JavaScript's location.href to redirect the user.

swal({
  title: "Go to Google?",
  text: "Clicking the button will redirect you to Google's website",
})
.then((shouldRedirect) => {
  if (shouldRedirect) {
    location.href = "https://www.google.com";
  }
})
Ok9xNirab commented 5 years ago

thanks