简体   繁体   English

使用“ window.location.href”的两个URL在功能上

[英]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. 我正在使用Marketo Embed,因此可以在使用时对其进行添加。

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). 我的目标是使用“ window.location.href”函数打开第一个URL(一个.zip文件),然后打开一个新的URL(一个页面)。

It's only using one of the URLS. 它仅使用其中一个URL。 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. 我已经对其进行了测试,但这一切似乎都是正确的,但是它认为我两次使用window.location.href都缺少一些有关规则的信息。

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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