Search code examples
javascripthtmlsweetalert2

Yandex.Map in SweetAlert2


How can I show my Yandex.Map in sweetalert2? I'd like to do smth like this:

swal.fire({
    titleText: 'Text',
    html: '<script type="text/javascript" charset="utf-8" async src="https://api-maps.yandex.ru/services/constructor/1.0/js/?um=constructor%3Ab46193b40b0e8c2a1d2b496978e42079dc8d5fa0f412936aa8e36b51163b57bd&amp;width=600&amp;height=500&amp;lang=ru_RU&amp;scroll=true"></script>'
})

or an alternative solution. I'm still a beginner in web-developing.

P.S. This site litlestuart.github.io/duckmarket


Solution

  • Swal.fire({
      html: `<iframe src="https://api-maps.yandex.ru/frame/v1/-/CVh7YBYg?lang=en_RU" width="100%" height="200" frameborder="0"></iframe>`
    })
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>