diff --git a/r2/r2/templates/ads.html b/r2/r2/templates/ads.html
index f2106722e..e5c1a2744 100644
--- a/r2/r2/templates/ads.html
+++ b/r2/r2/templates/ads.html
@@ -37,7 +37,7 @@
%>
$(function() {
var ad = $("#ad-frame");
- if(ad.height() == 0 || ad.width() == 0 || ad.offset().left == 0) {
+ if(!ad.length || ad.height() == 0 || ad.width() == 0 || ad.offset().left == 0) {
$(".footer").append("
");
}