-3

How to open a url in new window in sweet alert

2 Answers 2

1

you can use "window.open(URL,name,specs,replace)" for open in other window. Example:

swal({
  title: "Are you sure?",
  text: "You redirect in the new window in other page!",
  type: "warning",
  showCancelButton: true,
  confirmButtonClass: "btn-danger",
  confirmButtonText: "Yes, delete it!",
  cancelButtonText: "No, cancel plx!",
  closeOnConfirm: false,
  closeOnCancel: false
},
function(isConfirm) {
  if (isConfirm) {
    window.open("https://www.google.com");
  } else {
    window.open("https://www.yahoo.com");
  }
});
-1

Se quiser abrir em _blank use:

window.open("https://www.google.com", '_blank');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.