Title: Javascript appears on page
Last modified: August 8, 2023

---

# Javascript appears on page

 *  Resolved [aslamK](https://wordpress.org/support/users/4slam/)
 * (@4slam)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/javascript-appears-on-page/)
 * I got the code for the Follow button from [the generator](https://developer.wordpress.com/docs/follow-button-creation/).
   Upon adding it as a Custom HTML widget, it resulted in the following code:
 *     ```wp-block-code
       <aside id="block-45" class="widget widget_block"><a class="wordpress-follow-button" href="https://melange.dmaculate.me/home" data-blog="https://melange.dmaculate.me/home" data-lang="en">Follow dMaculate.melange on WordPress.com</a>
       (function(d){var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');p.type = 'text/javascript';p.async = true;p.src = '//widgets.wp.com/platform.js';f.parentNode.insertBefore(p,f);}(document));</aside>
       ```
   
 * This is what appears on the page:
 * [Follow dMaculate.melange on WordPress.com](https://melange.dmaculate.me/home)(
   function(d){var f = d.getElementsByTagName(‘SCRIPT’)[0], p = d.createElement(‘
   SCRIPT’);p.type = ‘text/javascript’;p.async = true;p.src = ‘//widgets.wp.com/
   platform.js’;f.parentNode.insertBefore(p,f);}(document));
 * Why is the JavaScript from the `<script />` tag rendering on the page? How can
   I fix it so that it renders the Follow button?
    -  This topic was modified 2 years, 9 months ago by [aslamK](https://wordpress.org/support/users/4slam/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Sara](https://wordpress.org/support/users/sarayourfriend/)
 * (@sarayourfriend)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/javascript-appears-on-page/#post-16957629)
 * Issues with the WordPress.com follow button generator should be taken up with
   WordPress.com’s support: [https://wordpress.com/support/](https://wordpress.com/support/)
 * There is a link at the bottom to get in touch with WordPress.com’s support folks.
 * For what it’s worth, if you’re pasting the HTML into a WordPress post and haven’t
   granted permissions to enable unfiltered HTML from your user, then WordPress 
   is going to strip the script tags. The snippet you’ve shared is missing the script
   tags that the generator includes. The script tag is necessary to tell browsers
   to view the JavaScript code as code to execute rather than just regular text.
   [You can read more about the `unfiltered_html` user capability in the documentation for it](https://wordpress.org/documentation/article/roles-and-capabilities/#unfiltered_html),
   but be aware that there are potential and significant security issues if it isn’t
   applied carefully. Enabling that would stop the site from stripping the script
   tag.
 *  Thread Starter [aslamK](https://wordpress.org/support/users/4slam/)
 * (@4slam)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/javascript-appears-on-page/#post-16960721)
 * [@sarayourfriend](https://wordpress.org/support/users/sarayourfriend/) thank 
   you for the explanation. Very helpful.
 * I posted the question here, instead of wordpress.com support, because I thought
   it was an HTML/JS issue, not specific to the Follow button. Turns out it’s both.
   According to the link you shared, “In WordPress Multisite, only Super Admins 
   have the `unfiltered_html` capability.” I added the widget as a site Administrator,
   not as Super Admin, which would explain why the script tags are getting stripped.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Javascript appears on page’ is closed to new replies.

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 2 replies
 * 2 participants
 * Last reply from: [aslamK](https://wordpress.org/support/users/4slam/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/javascript-appears-on-page/#post-16960721)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
