Add Inline Javascript
-
I want to add inline Javascript on footer of my wordpress site. I know we can add inline Javascript using wp_add_inline_script. From my understanding from Codex tutorial, we have to register and enqueue scripts and then using wp_add_inline_script.
Let say I:
- Register ScriptA.js using wp_register_script.
- Enqueue ScriptA.js using wp_enqueue_script.
- Add inline ScriptB.js using wp_add_inline_script with handle ScriptA.js.
My Question:
- As far as I can remember, Adblock Plus (Web browser ext) or similar can block external .js. If my ScriptA.js being blocked by Adblock Plus, will my ScriptB.js loaded?
- IF it is blocked, is there any other proper way I can add inline Javascripts? The only I can think is simply print (echo) it using wp_footer hook.
Reason using inline Javascripts: To prevent Adblock user from blocking my Ads script. Because Adblock Plus cannot block inline script as said by their Dev.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Add Inline Javascript’ is closed to new replies.