1

So I am calling the wistia script with a script tag in my head like this:

<script charSet='ISO-8859-1' src='//fast.wistia.com/assets/external/E-v1.js' async defer data-script='wistia' />

However, when I check out the network tab on Chrome, I notice that the E-v1.js script from Wistia is being loaded twice, which is rather significant as it is a 273kb script.

The first load of the script is from https://fast.wistia.com/assets/external/E-v1.js, the location to which I have called it.

However, the second load of the script comes from an iframe, despite me not having put any iframes on the page. This iframe calls the script even on webpages which do not contain any wistia videos. The referrer is: https://fast.wistia.com/embed/iframe_shim?domain=com.

What's going on here? I assume this is some trying-to-be-helpful behaviour from wistia to lazy load their script via an iframe, but it's already loaded...

4

1 回答 1

1

所以我联系了Wistia并得到了答复。他们的开发实践并不完全直观。

这是那个家伙说的:

iframe_shim 是一种跟踪 visitor_key 以进行统计跟踪的方法,并将该信息存储在 fast.wistia 域而不是您的域中。对于更轻量级的方法,您可以在页面上的脚本标签中设置 window.wistiaIframeShim = false,这将阻止 E-v1.js 再次加载。然后将通过 cookie 和 localstorage 直接在您的域而不是 fast.wistia.com 域上跟踪访问者。据我所知,这应该没有问题,我们最终会改变它的工作方式以提高效率,只是还没有优先考虑。

所以他们似乎从两个不同的来源加载了两次,只是为了在他们自己的域而不是客户端上存储少量信息。对我来说似乎很荒谬,但我现在可以确认您所要做的就是更改该窗口变量。

修复: window.wistiaIframeShim = false

于 2016-12-01T11:38:25.047 回答