简体   繁体   中英

Two URL's in function using “window.location.href”

I'm using a Marketo Embed for which allows me to add to it when I use it.

My goal is to use the "window.location.href" function to open the first URL (a .zip file) and then open a new URL (a page).

It's only using one of the URLS. Either one will work properly if they are the only one if the function. Otherwise it only fires the latter one. I've tested it and it all appears to be right, but it think I'm missing something about the rules with using window.location.href twice.

Here is my code:

    <script src="//app-sj01.marketo.com/js/forms2/js/forms2.min.js"></script>
    <form id="mktoForm_1198"></form>
    <script>MktoForms2.loadForm("//marketo.com", "000-000-000", 0000, function(form) {
form.onSuccess(function(values, followUpUrl) { 
       window.location.href = "************.zip";
       window.location.href = ".../page.html";
            return false;
    });});
    </script>

try

<script src="//app-sj01.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_1198"></form>
<script>
    MktoForms2.loadForm("//marketo.com", "000-000-000", 0000, function(form) {
        form.onSuccess(function(values, followUpUrl) { 
            var pid = window.setInterval(function() {
                window.location.href = ".../page.html";
                typeof pid !== 'undefined' && window.clearInterval(pid);
            }, 1000);
            window.location.href = "************.zip";
            return false
        ;});
    });
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM