如何以及什么是与jQuery异步加载GoDaddy的SSL篆书的最佳方法篆书、加载、方法、jQuery

2023-09-10 16:04:09 作者:断情戒爱

我已经在我的页脚一个地方,我想GoDaddy的SSL印章出现。截至目前,我只是有他们建议的HTML,它是立即调用 seal_installSeal()并呈现出相应的HTML通过文件撰写()的电话。

I've got a place in my footer where I want the GoDaddy SSL Seal to appear. As of right now, I just have the HTML they suggest, which is an inline script file that immediately calls seal_installSeal() and renders out the appropriate HTML through document.write() calls.

问题是,GoDaddy的剧本经常挂起。由于所有的我的脚本是在页面之前,右键我的封闭体标记以获得最佳页面加载速度,当G​​oDaddy的脚本挂起,它拖延的我的从初始化脚本底部。用户试图与页面交互之前,一切都加载完毕遇到缺少的功能或破碎的页面。

The problem is that GoDaddy's script hangs often. Since all of my scripts are at the bottom of the page right before my closing body tag for optimal page load speeds, when the GoDaddy script hangs, it delays my scripts from initializing. Users that try to interact with the page before everything finishes loading encounter missing functionality or a broken page.

GoDaddy的剧本绝不是必不可少的我的网页,为什么我应该等待它完成加载,让我的脚本初始化页面?所以我的想法是,为什么不通过 $加载异步。AJAX $。获得 $。getScript加入 $。负载 Modernizr.load

GoDaddy's script is by no means essential to my page, so why should I have to wait for it to finish loading to allow my scripts initialize the page? So my thought is, why not load it asynchronously via $.ajax or $.get or $.getScript or $.load or Modernizr.load?

我从未需要通过jQuery的Ajax方法加载的什么的,更何况是一个远程脚本文件,因为我的ASP.NET项目使用的UpdatePanel现在。我的问题是双重的,并根据第二部分可以被捆绑在一起:

I have never needed to load anything, let alone a remote script file, via jQuery's ajax methods, as my ASP.NET project uses UpdatePanels for now. My question is two-fold and may be tied together based on the 2nd part:

什么是使用时负载远程脚本的最佳方法是什么?它是 $明显的突出。getScript加入脚本()

由于GoDaddy的脚本立即初始化,使的document.write()电话,我怎么可以把那些我想在我的页脚?

Since GoDaddy's script immediately initializes and makes document.write() calls, how can I place those where I want to in my footer?

我想创建一个的jsfiddle,但恐怕它提供了产地http://fiddle.jshell.net不受访问控制 - 允许 - 产地允许的。错误尝试加载该脚本时。

I would create a jsFiddle, but I'm afraid it offers up the Origin http://fiddle.jshell.net is not allowed by Access-Control-Allow-Origin. error when attempting to load this script.

推荐答案

这是一段时间,所以我想我会留下一个答案与我最后做背那么:

It's been awhile, so I figured I'd leave an answer with what I ended up doing back then:

我基本解除,需要等待GoDaddy的服务器上通过简单地重写剧本在我结束了所有必要位下载脚本。

I basically removed the need to wait on GoDaddy's server to download the script by simply rewriting the script on my end with all the necessary bits.

在我的页脚,我有包含GoDaddy的SSL印章图像一个div:

On my footer, I had a div containing the GoDaddy SSL Seal image:

<div id="GoDaddySSLSeal">
    <img src="https://m.xsw88.com/allimgs/daicuo/20230910/496.png" />
</div>

然后在我的脚本文件,我迷上了一个click事件的IMG,以及一个简单的小淡入动画:

Then in my script file, I hooked up a click event to the img, as well as a simple little fadeIn animation:

$("#GoDaddySSLSeal img")
    .on("click", verifyGoDaddySSLSeal)
    .preloadImages(function() { $(this).fadeIn(2000); });

在verifyGoDaddySSLSeal单击事件,我只是做自己的脚本的要点做了:

In the verifyGoDaddySSLSeal click event, I just do what the gist of their script did:

function verifyGoDaddySSLSeal()
{
    window.open
    (
        "https://seal.godaddy.com/verifySeal?sealID=<my seal id went here>", 
        "SealVerfication",
        "location=yes,status=yes,resizable=yes,scrollbars=no,width=592,height=433"
    );
}