Skip to content

Instantly share code, notes, and snippets.

Last active June 10, 2023 14:40
Show Gist options
  • Save ryankearney/4146814 to your computer and use it in GitHub Desktop.
Save ryankearney/4146814 to your computer and use it in GitHub Desktop.
This is the code Comcast is injecting into its users web traffic.

Above is the code Comcast is injecting into their customers web traffic when they need to display an "important message".

Feel free to read the blog post that goes along with this code.

<script language="JavaScript" type="text/javascript">
// Comcast Cable Communications, LLC Proprietary. Copyright 2012.
// Intended use is to display browser notifications for critical and time sensitive alerts.
var SYS_URL='/e8f6b078-0f35-11de-85c5-efc5ef23aa1f/aupm/';
// var image_url='';
var image_url='';
var headertext1='<strong>Comcast Courtesy Notice</strong>';
var textline1='You have reached 90% of your <b>monthly data usage allowance</b>.';
var textline2='Please sign in for more information and to remove this alert.';
var acknowledgebutton='<a href=\"#\" onClick="document.location.href=\''+SYS_URL+'?dispatch=redirect&redirectName=login&paramName=bmUid\'" title="Sign in to acknowledge" style="color: #FFFFFF;"><img alt="Sign in to acknowledge" src="'+image_url+'/mt_signin.png"/></a>';
var verifybulletin='<a href="" target="_new">How do I know this message is from Comcast?</a>';
if(self.location==top.location) {
document.write('<style type="text/css">');
document.write('#comcast_content {width: 600px; height:240px; box-shadow: 10px 10px 5px #888; background: #fff; border: 1px solid #454545; position:absolute; top:50px; left:100px; zoom:1; z-index: 9999999; opacity:0.90; filter:alpha(opacity=90);}');
document.write('#comcast_content .header {height: 35px; background:url('+image_url+'/headerbg.gif) repeat-x;}');
document.write('#comcast_content .a {color: #00a3e0;}');
document.write('#comcast_content .logo {float:left;}');
document.write('#comcast_content .content-wrapper {padding-left: 18px; padding-right: 15px; padding-bottom: 12px;}');
document.write('#comcast_content .headerimage { margin-top: 15px;}');
document.write('#comcast_content .header1 {margin: 18px 0 0 0; color: #C00000; padding: 3px; font: 23px/24px bold Arial, Helvetica, sans-serif;}');
document.write('#comcast_content .textcontent {margin: 12px 0 0 0; text-align: center; color: #303030; word-spacing: 0px; font: 14px/15px Arial, Helvetica, sans-serif; line-height: 1.20;}');
document.write('#comcast_content .acknowledge {padding-top:6px; text-align: center;}');
document.write('#comcast_content .how-do-i {float:left; position:absolute; bottom:20px; left:18px; margin: 12px 0 0 0; font: 13px/14px bold Arial, Helvetica, sans-serif; text-align: bottom;}');
document.write('#comcast_content .comcast-wrapper {float:right; position:absolute; bottom:15px; right:18px; padding-top:0px; text-align: right;}');
document.write('<div class="main-wrapper" id="comcast_content">');
document.write('<div class="header" onmousedown="javascript:dragStart(event,\'comcast_content\')">');
document.write('<img src="'+image_url+'/xfinity-logo.gif" alt="Xfinity" class="logo"/>');
document.write('<div class="content-wrapper">');
document.write('<p class="header1">');
document.write('<p class="textcontent">');
document.write('<p class="textcontent">');
document.write('<p class="how-do-i">');
document.write('<div class="acknowledge">');
document.write('<div class="comcast-wrapper">');
document.write('<img src="'+image_url+'/message-by-comcast.gif" alt="Message by Comcast"/>');
// Function to Determine browser and version. Copyright 2001 by Mike Hall.
// See for terms of use.
function Browser() {
var ua, s, i;
this.isIE = false;
this.isNS = false;
this.version = null;
ua = navigator.userAgent;
s = "MSIE";
if ((i = ua.indexOf(s)) >= 1) {
this.isIE = true; this.version = parseFloat(ua.substr(i + s.length)); return;
s = "Netscape6/";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true; this.version = parseFloat(ua.substr(i + s.length)); return;
s = "Gecko";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true; this.version = 6.1; return;
var browser1 = new Browser();
var dragObj = new Object();
dragObj.zIndex = 99999;
function dragStart(event, id) {
var el;
var x, y;
if (id) dragObj.elNode = document.getElementById(id);
else {
if (browser1.isIE) dragObj.elNode = window.event.srcElement;
if (browser1.isNS) dragObj.elNode =;
if (dragObj.elNode.nodeType == 3) dragObj.elNode = dragObj.elNode.parentNode;
if (browser1.isIE) {
x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
if (browser1.isNS) {
x = event.clientX + window.scrollX;
y = event.clientY + window.scrollY;
dragObj.cursorStartX = x;
dragObj.cursorStartY = y;
dragObj.elStartLeft = parseInt(, 10);
dragObj.elStartTop = parseInt(, 10);
if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 100;
if (isNaN(dragObj.elStartTop)) dragObj.elStartTop = 50;
if (browser1.isIE) {
document.attachEvent("onmousemove", dragGo);
document.attachEvent("onmouseup", dragStop);
window.event.cancelBubble = true;
window.event.returnValue = false; }
if (browser1.isNS) {
document.addEventListener("mousemove", dragGo, true);
document.addEventListener("mouseup", dragStop, true);
// End Function
function dragGo(event) {
var x, y;
if (browser1.isIE) {
x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
if (browser1.isNS) {
x = event.clientX + window.scrollX; y = event.clientY + window.scrollY;
} = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px"; = (dragObj.elStartTop + y - dragObj.cursorStartY) + "px";
if (browser1.isIE) { window.event.cancelBubble = true; window.event.returnValue = false; }
if (browser1.isNS) event.preventDefault(); }
function dragStop(event) {
if (browser1.isIE) {
document.detachEvent("onmousemove", dragGo);
document.detachEvent("onmouseup", dragStop);
if (browser1.isNS) {
document.removeEventListener("mousemove", dragGo, true);
document.removeEventListener("mouseup", dragStop, true);
var xmlhttp=false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @end @*/ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } } if (!xmlhttp && window.createRequest) { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } }
function acknowledge() { sendAck(); document.getElementById('comcast_content').style.display="none"; }
function sendAck(){"GET", SYS_URL+'?dispatch=ackBulletin',true); xmlhttp.send(null) }
var comcastCheck=1;
var comcastTimer;
function checkBulletin(){
if(comcastCheck==0) { return; }"GET", SYS_URL+'?dispatch=checkBulletin',true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
Copy link

hydranix commented Dec 29, 2016

I'm not even joking, but in the injection I just saw (Dec 29th 2016)

<script language="JavaScript" type="text/javascript">
// Comcast Cable Communications, LLC Propriertary, Copyright (C) 2012-2013 Comcast
// Intended use of this message is to display critical and time sensitive notifications to customers.

Note the spelling of "Propriertary".

Copy link

SpaceOctopus commented Mar 30, 2017

This is ridiculous. I can confirm it happens, as I have now received such notifications at least 3 times. I'm curious as to whether or not I can report this behavior to the FTC. The more reports they get about stuff like this, the more likely they are to do something about it. They must be doing something illegal here. Even if it's just using GPL code without permission.
I really hate Comcast as it is already, but when they are basically the monopoly where you live (no other provider), this is not just your run of the mill security flaw. Internet is a utility, and everyone needs it. To simply claim we can just stop paying Comcast is a gross oversimplification of the problem & completely ignores the fact this is a huge security flaw, not to mention the fact I think they're not allowed to hijack or inject your connection? Where the hell is consumer protection? Why is this allowed?

It's bad enough that they are imposing a bandwidth cap at all, especially when they are obviously lying about their reasons, and lying to customers by saying nonsense about how less than 1% of users use more than 1TB in a month, and that those people cause any sort of problem whatsoever, or that it should cost more or less depending on how much you use. That is retarded. Anyone with half a brain knows this is just a grab for more money. It doesn't cost them a dime extra to let the supposed 1% use more than that 1TB, not to mention the fact that 1% isn't even enough of a percentage to be worth doing anything about. Take into consideration the fact that these users are technically just using the bandwidth that isn't used by those people using less than 100gb in a month.... anyway, I feel like everyone is just allowing comcast to bend them over & taking it like they have to. Report them to the FTC. Do something. Just because data caps don't affect you, doesn't mean they are acceptable, or reasonable. You're screwing the rest of us. It is extremely unreasonable to charge overage fees the way they do. They can charge you up to $200 for overage. Per month. If you want truly unlimited internet, like you've been paying for FOR YEARS, and signed a contract for, you have to pay an additional $50 a month, on top of the amount you already pay, which is bullshit considering the fact you're paying for speeds you don't even get 1/8th of on a good day (even with a badass, brand new, super fast router & modem you pay for yourself)..... :(

@hydranix LOL at propriertary.

Copy link

r3wt commented Jun 21, 2017

@SpaceOctopus this is legal unfortunately. I would suggest writing letters to your representative(s). If enough people make enough noise about this, eventually a bill could be brought to make this practice illegal.

Copy link

deavial commented Dec 16, 2017

@r3wt how is this legal? what law makes it legal? When a customer is coming to my site and they intercept the code that I own the copyright to and modify it, they are illegally making a derivative work of my code. I don't see how anyone can claim this is legal. I am waiting for a response from our attorneys, we are looking for any cases that legalize this, but right now I don't see how anyone can claim this is legal.

Copy link

farzher commented Mar 5, 2019

still getting this message in 2019. doesn't seem like a very "critical time sensitive" notification.
how is this legal !?!? i thought for sure i had a virus. is the page i was visiting


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment