0

I'm looking for a way to have a popup modal with a form, and whent he popup loads, the URL changes.

For example, if a person is viewing web.com/about and the popup loads, then it will change the URL to web.com/about?utm_form=popup

Is this possible?

Maybe it will add this utm to the URL when the popup is open, and removes it when closed? A plugin would be helpful.

Thanks for any thoughts.

1
  • Is it possible for you to use Bootstrap 3 or 4? Are you already using it? Or another CSS framework? May 26, 2019 at 18:49

1 Answer 1

0

If you are using bootstrap modal so below code is working :

$('#myModal').on('loaded.bs.modal', function (e) {
  if (typeof (history.pushState) != "undefined") {
        var obj = { Title: "About Us", Url: 'about?utm_form=popup' };
        history.pushState(obj, obj.Title, obj.Url);
    }
})

Your Answer

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

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