Title: Adding Java direct to page (editor)
Last modified: October 14, 2019

---

# Adding Java direct to page (editor)

 *  [YOELO](https://wordpress.org/support/users/yoebo/)
 * (@yoebo)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/adding-java-direct-to-page-editor/)
 * I’m using Woocommerce and Storefront theme. I’ve added a simple java countdown
   timer to a single page direct in the (text) editor. It works but was wondering:
 * **1.** Should it work? I assumed WordPress would delete it upon saving.
    **2.**
   Can it cause any security issues?
 *     ```
       <script>
       function makeMeTwoDigits(n){
           return (n < 10 ? "0" : "") + n;
       }
       // Set the date we're counting down to
       var countDownDate = new Date("oct 20, 2019 15:37:25").getTime();
   
       // Update the count down every 1 second
       var x = setInterval(function() {
   
         // Get today's date and time
         var now = new Date().getTime();
   
         // Find the distance between now and the count down date
         var distance = countDownDate - now;
   
         // Time calculations for days, hours, minutes and seconds
         var days = Math.floor(distance / (1000 * 60 * 60 * 24));
         var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
         var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
         var seconds = Math.floor((distance % (1000 * 60)) / 1000);
   
         // Output the result in an element with id="dhms"
         document.getElementById("dhms").innerHTML = 
   
         "<div class='dhmsnums'>" + makeMeTwoDigits(days) + "<span class='dhmstext'>d</span></div>" + 
         "<div class='dhmsnums'>" + makeMeTwoDigits(hours) + "<span class='dhmstext'>h</span></div>" 
         +   "<div class='dhmsnums'>" + makeMeTwoDigits(minutes) + "<span class='dhmstext'>m</span></div>" 
         +   "<div class='dhmsnums'>" + makeMeTwoDigits(seconds) + "<span class='dhmstext'>s</span></div>";
   
         // If the count down is over, write some text 
         if (distance < 0) {
           clearInterval(x);
           document.getElementById("dhms").innerHTML = "EXPIRED";
         }
       }, 1000);
       </script>
       ```
   
    -  This topic was modified 6 years, 5 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).

Viewing 1 replies (of 1 total)

 *  [Tyler](https://wordpress.org/support/users/tylerthedude/)
 * (@tylerthedude)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/adding-java-direct-to-page-editor/#post-12027428)
 * Hi there,
 * I’m not entirely sure that WordPress will delete the page upon the expiration
   set in the script since it’s embedded directly in the page, but it might. If 
   it doesn’t, then you can always manually delete the page in question.
 * As for the potential security vulnerability – From looking over the script, no
   functions appear to be called incorrectly and the script seems to be well-defined.
   You can always check your console on this page and see if it returns with any
   type of false/positives.
 * Thanks!
    Tyler

Viewing 1 replies (of 1 total)

The topic ‘Adding Java direct to page (editor)’ is closed to new replies.

## Tags

 * [editor](https://wordpress.org/support/topic-tag/editor/)
 * [java](https://wordpress.org/support/topic-tag/java/)
 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [script](https://wordpress.org/support/topic-tag/script/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Tyler](https://wordpress.org/support/users/tylerthedude/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/adding-java-direct-to-page-editor/#post-12027428)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
