Title: Exclude JS code from cache
Last modified: May 11, 2023

---

# Exclude JS code from cache

 *  Resolved [mihodono](https://wordpress.org/support/users/mihodono/)
 * (@mihodono)
 * [3 years ago](https://wordpress.org/support/topic/exclude-js-code-from-cache/)
 * Hello, I would like to know if there is any way we could exclude certain codes
   of JavaScript from being cached?
 * Currently, the website I’m working on has a plugin that is rendering certain 
   codes of JavaScript in the header that essentially takes the user’s IP address
   and tells which country the current user is located. However, it seems that W3
   Total is caching the JavaScript code resulting to wrong countries being shown.
   Is there any way we could exclude that code from being cached?
 * Thank you very much.

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [3 years ago](https://wordpress.org/support/topic/exclude-js-code-from-cache/#post-16729480)
 * Hello [@mihodono](https://wordpress.org/support/users/mihodono/)
 * Thank you for reaching out and I am happy to assist you with this.
 * Can you please share which plugin you are using for this and if this file is 
   loading on all pages, and please let me know what are the Settings enabled in
   the W3TC General settings.
 * Thanks!

Viewing 1 replies (of 1 total)

The topic ‘Exclude JS code from cache’ 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

 * [cache](https://wordpress.org/support/topic-tag/cache/)
 * [caching](https://wordpress.org/support/topic-tag/caching/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 1 reply
 * 2 participants
 * Last reply from: [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * Last activity: [3 years ago](https://wordpress.org/support/topic/exclude-js-code-from-cache/#post-16729480)
 * Status: resolved