Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8756097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:59:25+00:00 2026-06-13T13:59:25+00:00

Having a bunch of 3rd party tracking and adservers scripts that are executed by

  • 0

Having a bunch of 3rd party tracking and adservers scripts that are executed by using documnet.write() and I do believe using this method is not the best practice and instead one should use the dom friendly manipulation mentioned by anakata here

Now my question is where in the page(head, foot, body etc) and when (on page load, after the page is loaded or while the page is loading) can we fire these scripts?

current script example:

<script type="text/javascript">
var p = (("https:" == document.location.protocol) ? "https://" : "http://");
document.write(unescape("%3Cscript src='" + p + "clickops.net/clickops-tracker.v1.js' type='text/javascript'%3E%3C/script%3E"));
</script>

Can we use this snippet to append external scripts as a good example?

var script   = document.createElement("script");
script.type  = "text/javascript";
script.src   = "path/to/your/javascript.js";    // use this for linked script
document.head.appendChild(script);

I appreciate your valuable feedback.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:59:27+00:00Added an answer on June 13, 2026 at 1:59 pm

    Yes, you can use that (though I’d use document.head instead of #someElement).

    Yet, if you have jQuery around you can use its already existing and very powerful ajax method:

    $.ajax(url, {dataType: "script", cache:"true"});
    

    or, if you don’t want caching, also jQuery.getScript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a 3rd party app that uses regex to searches html documents, in
So I have an animation that is being created by having a bunch of
Rather than having a bunch of links that are all different sizes, I want
I'm having some trouble using resource files. In my project I'm using a bunch
I have a bunch of AppleScript scripts in a directory that I want to
I'm using Jodatime in my Play app, but currently having to do a bunch
I'm having a bunch of custom-made Reference Classes and would like to write coercion
This is an assignment question that I am having trouble wording an answer to.
For a project we having a bunch of data that always have the same
My issue is quite simple: I'm having a bunch of unit tests using pymox.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.