From 3f3980d4444074d9cab1370f7bf700c811e970eb Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 5 Feb 2020 00:13:29 -0500 Subject: [PATCH] completely prevent ads from rendering on mobile devices --- lbrytv/component/ads.jsx | 32 +++++++++++++++------------- ui/component/sideNavigation/view.jsx | 8 +------ 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/lbrytv/component/ads.jsx b/lbrytv/component/ads.jsx index 1130a504b..9068d9ffa 100644 --- a/lbrytv/component/ads.jsx +++ b/lbrytv/component/ads.jsx @@ -6,6 +6,7 @@ import I18nMessage from 'component/i18nMessage'; import Button from 'component/button'; const ADS_URL = '//assets.revcontent.com/master/delivery.js'; +const IS_MOBILE = typeof window.orientation !== 'undefined'; type Props = { location: { pathname: string }, @@ -15,26 +16,27 @@ function Ads(props: Props) { const { location: { pathname }, } = props; - useEffect(() => { - const script = document.createElement('script'); + if (!IS_MOBILE) { + const script = document.createElement('script'); - script.src = ADS_URL; - script.async = true; + script.src = ADS_URL; + script.async = true; - // $FlowFixMe - document.body.appendChild(script); - - return () => { // $FlowFixMe - document.body.removeChild(script); - // if user navigates too rapidly,