Problems loading sweet javascript alert libraries

1

I'm trying to load the libraries on a local server but for some strange reason they do not load.

However, if I load it from codepen or from stackoverflow it works without problems ... I want to be loaded locally.

Next the code

<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

<script>
  swal("Hello world!");
</script>
    
asked by Luis Alfredo Serrano Díaz 22.11.2018 в 21:03
source

2 answers

1

I would recommend you, access the link, copy the code that shows you and save it in your project folder, and only replace in script by the address where you saved it.

<script src="direccion de carpeta/sweetalert.min.js"></script>
    
answered by 22.11.2018 в 21:10
0

The problem I solved locally was adding all the html tags ie.

<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<head>
  <body>

<script>
  swal("Error!", "Esto es un mensaje!", "error");
</script>

</body>
</html>
    
answered by 23.11.2018 в 13:16