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 7592521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:55:39+00:00 2026-05-30T20:55:39+00:00

I have page with many doubleclick scripts I have js code inserted at the

  • 0
  1. I have page with many doubleclick scripts
  2. I have js code inserted at the body top (via s.src=(‘parts_async_dev.js’)):

    var innerHTML = document.getElementsByTagName('html')[0].innerHTML.toString();
    var regexp = /ad.doubleclick.net/gm;
    var matches = innerHTML.match(regexp);
    alert('found ' + matches.length + ' tags by regexp ' + regexp);
    console.log( innerHTML);
    

alert says that matches returns only 2 of ad.doubleclick.net tags.
I thought first that code can not access whole body if not placed at the body very bottom.
But it finds 2 tags inside div “interstitial_wrapper” which comes after my code.

So my questions are:

  • why is it so
  • How to access whole body form body start ( i may not use body ‘onload’ event. it is required to use script asap)

Please take a look at http://wap7.ru/folio/bannerstat/partners/doubleclick2.html
and see view source, because it is too large to include here.

  • 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-05-30T20:55:41+00:00Added an answer on May 30, 2026 at 8:55 pm

    You don’t have to bind to the onload event. Just bind to the DOMContentLoaded event.

    Since you’ve already included jQuery in your page, this can esily be done using .ready:

    $(document).ready(function() {
        var innerHTML = document.body.innerHTML;
        /* If you want to use a RegExp, use the following:
        var regexp = /ad\.doubleclick\.net/gi; // Note: escaped dot
        var matches = innerHTML.match(regexp);
        matches = matches ? matches.length : 0; // matches can be `null`
        */
    
        // This is more effective:
        var matches = innerHTML.split('ad.doubleclick.net').length - 1;
        alert('Found ' + matches + ' tags.');
        console.log( innerHTML );
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page with many forms in panels and usercontrols, and a requiredfield
I have a page with many forms on it. could be 1..200. None of
If I have a single page with many forms of existing records: index.html.haml -
I have a page upon which a user can choose up to many different
I have a ASP.NET web page that contains many textboxes. Each textbox has a
I have many links in my page. For example <a href=/promotions/download/schools/australia.aspx>Australia</a> Now I want
i have many events such as $('.hidefile').click(function (event) { On page load and on
Many applications have grids that display data from a database table one page at
I have a asp.net page with .net controls. For a long time, many years,
how can i do. i have many html elements on page. after clicking on

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.