You are using deprecated options in your code(type, showCancelButton etc).
I would recommend you to give class for edit buttons/id if you only have one.
Bind click event on it via jQuery and use then() method for swal.
Example:
<a href="/" class="editButton">edit</a>
And javascript:
var $editButton = $('.editButton');
$editButton.on('click', function(e) {
  e.preventDefault();
  swal({
      title: 'Are you sure?',
      text: 'By clicking \'OK\' you will be redirected to the link.',
      icon: 'warning',
      buttons: {
          cancel: true,
          confirm: true
      }
  }).then(function(value) {
      if (value) {
          //  Either true or null
          window.location.href = "https://www.stackoverflow.com";
      }
  });
});
Inline example
If you want to do it inline, then add onclick attribute to your element and send url via it:
<a href="/" class="editButton" onclick="foo(event, 'https://www.stackoverflow.com');">edit</a>
And javascript:
function foo(event, url) {
    event = event || window.event;
    event.preventDefault();
    swal({
        title: 'Are you sure?',
        text: 'By clicking \'OK\' you will be redirected to the link.',
        icon: 'warning',
        buttons: {
            cancel: true,
            confirm: true
        }
    }).then(function(value) {
        if (value) {
            //  Either true or null
            window.location.href = url;
        }
    });
}