Title: Using obsolete code (type=&#8221;text/javascript&#8221;)
Last modified: January 31, 2019

---

# Using obsolete code (type=”text/javascript”)

 *  Resolved [makhovik](https://wordpress.org/support/users/makhovik/)
 * (@makhovik)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/using-obsolete-code-typetext-javascript/)
 * validator.w3.org shows the warning when using async or defer script minifying:
 * “The type attribute is unnecessary for JavaScript resources.
    From line 153, 
   column 1; to line 153, column 101 <script defer type=”text/javascript” src=”/
   wp-content/cache/minify/c740d.js”>”
 * The reason: type=”text/javascript” attribute is obsolete in html5, and you may
   freely remove it from the code everywhere.
 * I suggest some changes to Minify_Plugin.php:
    /** * Prints script tag * * [@param](https://wordpress.org/support/users/param/)
   string $url * [@param](https://wordpress.org/support/users/param/) string $embed_type*
   [@return](https://wordpress.org/support/users/return/) string */ function generate_script_tag(
   $url, $embed_type = ‘blocking’ ) { static $non_blocking_function = false;
 *  if ( $embed_type == ‘blocking’ ) {
    $script = ‘<script src=”‘ . str_replace(‘&’,‘&’,
   $url ) . ‘”></script>’; } else { $script = ”;
 *  if ( $embed_type == ‘nb-js’ ) {
    if ( !$non_blocking_function ) { $non_blocking_function
   = true; $script = “<script>function w3tc_load_js(u){var d=document,p=d.getElementsByTagName(‘
   HEAD’)[0],c=d.createElement(‘script’);c.src=u;p.appendChild(c);}</script>”; }
 *  $script .= “<script>w3tc_load_js(‘” .
    $url . “‘);</script>”;
 *  } else if ( $embed_type == ‘nb-async’ ) {
    $script = ‘<script async src=”‘ .
   str_replace( ‘&’, ‘&’, $url ) . ‘”></script>’; } else if ( $embed_type == ‘nb-
   defer’ ) { $script = ‘<script defer src=”‘ . str_replace( ‘&’, ‘&’, $url ) . ‘”
   ></script>’; } else if ( $embed_type == ‘extsrc’ ) { $script = ‘<script extsrc
   =”‘ . str_replace( ‘&’, ‘&’, $url ) . ‘”></script>’; } else if ( $embed_type 
   == ‘asyncsrc’ ) { $script = ‘<script asyncsrc=”‘ . str_replace( ‘&’, ‘&’, $url).‘”
   ></script>’; } }
 *  return $script . “\r\n”;
    }
    -  This topic was modified 7 years, 4 months ago by [makhovik](https://wordpress.org/support/users/makhovik/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fusing-obsolete-code-typetext-javascript%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/using-obsolete-code-typetext-javascript/#post-11153108)
 * Hello,
    Thank you for the suggestion. I’ve spoken with the team and this will
   be included in the next release. Once again thank you for the suggestion.
 *  Thread Starter [makhovik](https://wordpress.org/support/users/makhovik/)
 * (@makhovik)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/using-obsolete-code-typetext-javascript/#post-11153758)
 * Thanks a lot.

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

The topic ‘Using obsolete code (type=”text/javascript”)’ is closed to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

## Tags

 * [validation](https://wordpress.org/support/topic-tag/validation/)
 * [warning](https://wordpress.org/support/topic-tag/warning/)

 * 2 replies
 * 2 participants
 * Last reply from: [makhovik](https://wordpress.org/support/users/makhovik/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/using-obsolete-code-typetext-javascript/#post-11153758)
 * Status: resolved