Can not read property 'dispatchEvent' of null



I am trying to integrate MoPub ads in my html5 app. I have generated the Ad Unit ID and paste the given code in my head tag of html page. But I am getting an error “Can not read property ’ dispatchEvent’ of null” in mobileweb.min.js.

I am not getting the reason why this is happening.