I hate it when useless javascript slows down my machine.

Is there a way to do ad placement without JavaScript?

I've learned that, for example, iframe element has a sandbox attribute, which lets you disable JavaScript in an iframe. Are there a way to use that to serve ads?

  • JavaScript is not naturally slow, if your experiencing a slow experience then its either Adobe Flash, or poorly written JavaScript. Stack Exchange uses JavaScript, and its ultra-fast... disable video adverts if your that concerned as they will use HTML5 video, or flash, which obviously is a lot slower and consume far more CPU resources, locally. Adwords for example can be slow at rendering sometimes, but this isn't necessary down to JavaScript, its the DNS lookup, Server First Byte, and Server Response, JavaScript isn't the main issue. Dec 15 '15 at 18:03
  • @SimonHayter, I'm not disputing that the tool is wrong, just the way people use it; how do I disable Adobe Flash or poorly written JavaScript from being executed in the browser of my visitors? (I've disabled Adobe Flash on my own machines probably some decade ago!)
    – cnst
    Dec 16 '15 at 6:00

There is no need to do this as javascript based ad placements, especially from advertising networks such as Google AdSense are highly optimized to reduce the load on the page, in addition they frequently work asynchronously once the script has been loaded, loading the ad to the page outside the normal document render so it doesn't block the page render. The more likely culprit of page load issues is poorly optimized javascript being injected on your page such as synchronous blocking scripts.

  • loading new elements after the rest of the page has finished loading may result in element reshuffle, which is horrible for usability of the site -- someone tried clicking on one element, instead there's a race condition, and they end up clicking on a totally unrelated one instead. this is exactly the reason why I want to avoid having javascript in the first place!
    – cnst
    Jul 7 '16 at 1:02
  • Javascript is very useful and when used properly you will find that when done right clicking on unrelated elements doesn't become as much of a problem. Use the Stack Exchange platform itself. So much of it is powered by javascript including adding comments, answers, voting, flaagging, etc, and there is no issues with clicking on something and accidentally clicking something else. Even with advertising networks such as Google AdSense the javascript code is generally used to define an element at the right size and then come back later to populate it to prevent after load position changes. Jul 7 '16 at 1:06
  • 2
    The whole point of javascript is that it can do anything. I don't want a third-party to be able to control my web-site in full. That's the whole point of wanting to not have any third-party javascript around.
    – cnst
    Jul 7 '16 at 1:12
  • 1
    No, it's not different. Today Google or Yandex ad networks might not slow down modern browsers. Tomorrow, that might not be the case. And they couldn't care less, because only 1% of people are affected. They do this with various products all the time. I don't want to deal with all these issues. There is no such shortcoming with javascript-less ads. Moreover, the number of stories where viruses get spread through these javascript-friendly networks wouldn't get any fewer as days go by if we all continue letting anyone embed any javascript onto our pages.
    – cnst
    Jul 7 '16 at 1:23
  • 1
    Google AdSense is not highly optimised in the slightest. It is abysmally inefficient. For example, with AdBlock Plus enabled, loading a reasonably heavy webpage with three banner ads on gives me the following result: 38 requests 1.4MB, load 1.07s. Now, if I DISABLE AdBlock Plus, and reload the same page (emptied cache prior to load for all tests), with three banner ads on the page, I get the following result: 168 requests, 2.1MB transferred, load 4.94s. That's terrible. Just three ads. I counted 7 iframes loaded in a single banner ad. Yeah, that's not highly optimised haha!
    – thephpdev
    Aug 3 '18 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.