Dynamically load scripts and js cross-site access data

Source: Internet
Author: User
1. You can dynamically load the script tag to load variables across domains.
Cross-origin cannot be loaded directly in ajax mode, but scrit labels can be used for loading.
Some problems may occur during use (not successful), but you can put the value in the dom first.

2. The script tag contains the addEventListener onload event, which processes the events after the variables are loaded successfully.

3. When a tor accesses a page, a random number must be added to force refresh (unknown test)

4. the ip address of the tor is slow and unstable. Sometimes the ip address is not updated for dozens of seconds or even dozens of minutes.

5. The ip address displayed on the tor homepage has become very fast and has not actually changed. Unknown reason.

// Dynamically load the Script tag (to handle Memory leakage issues)
Function OnScriptLoaded ()
{
Var status = document. title;
}

Function LoadScript ()
{
Var script = document. getElementById ('scriptid ');
If (script)
{
Document. getElementsByTagName ("head") [0]. removeChild (script );
Script = null;
}

Script = document. createElement ("script ");
Script. type = "text/javascript ";
Script. id = "ScriptId ";
Script. addEventListener ("load", OnScriptLoaded, false );
Script. src = "http://www.guoguoer.cn/abcd.php? P = u & rnd = "+ Math. random ();
Document. getElementsByTagName ("head") [0]. appendChild (script );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.