title: Prevent automatic page refresh with SweetAlert
body: <p>I have several pages on my website that refresh the pages after a function using javascript or sometimes turbolinks and even action cable.</p>
  <p>I want to use SweetAlert to display information but its not very helpful because it displays right before a refresh so it is only visible for a quick moment.</p>
  <p>Based on previous stack overflow questions I have constructed this:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>      Swal.fire({
          title: 'Sweet!',
          text: `You got the ${data.badge.description} badge!`,
          imageUrl: data.badge_image_url,
          imageWidth: 200,
          imageHeight: 200,
          imageAlt: 'Custom image'
          },
          function(isConfirm) {
            if (isConfirm) {
              window.location.reload();
            }
          });</code></pre>
  </div>
  </div>
  </p>
  <p>However, it does not seem to fix the issue.</p>