We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

javascript caching issue

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
always24x7
Posts: 30
Joined: Tue Apr 18, 2006 3:05 pm
Location: Bedford, TX

javascript caching issue

Post by always24x7 »

I am using some javascript to do some of the heavy lifting on the dom parsing from the data tag.

It appears that changes to the javascript are not being seen by the interpreter. Like it is caching the javascript.

I have put the vxml code inside a php program to prevent caching and that seems to work, but the javascript is an include in the vxml pitched by the php program.

ie: <script src="http://www.somedomain.com/ivr/util.js"/>

Is there a way to force this out of cache manually or to force it to load every time?

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

IVR example to force cache reset using maxage attribute

Post by support »

Hello,

The best way to force a cache reset is to use the maxage attribute or IVR *maxage global properties. For IVR example:

Code: Select all

<script src="http://www.somedomain.com/ivr/util.js" maxage="0"/>
This will tell our caching system to refresh the cache and get the latest copy. This attribute is available for all IVR tags that request data.

Regards,
Plum Support
Last edited by support on Tue Feb 23, 2010 2:43 pm, edited 3 times in total.

always24x7
Posts: 30
Joined: Tue Apr 18, 2006 3:05 pm
Location: Bedford, TX

Post by always24x7 »

I put the maxage="0" in one of my scripts, using the exact syntax below. It does not appear to work.

I put new functions in the javascript, but the vxml keeps saying they don't exist.

Is there any way to force it out of cache?

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

placement of maxage in IVR script

Post by support »

maxage="0" should not go into any of your IVR scripts. It should go into the IVR tag, <script>, that references your IVR scripts.

Can you paste in a snippet of your VoiceXML code that references your javascript page?
Last edited by support on Thu Feb 25, 2010 1:29 pm, edited 5 times in total.

always24x7
Posts: 30
Joined: Tue Apr 18, 2006 3:05 pm
Location: Bedford, TX

Post by always24x7 »

This problem has been worked around.

I built a small html page to use the functions in my included util.js and could not access it there either. After a bunch of trial and error I determined a couple of things:

One
====
<script src="http://www.somedomain.com/ivr/util.js" maxage="0"/>

Does not work reliably if there are other <script> tags in the html.
You have to use:
<script src="http://www.somedomain.com/ivr/util.js" maxage="0"></script>

What it was doing in the html was running the code in that <script> tag, but no other <script> tags if the </script> tag was missing. Putting the /> at the end was not sufficient. I believe I tested this in both IE and Firefox.

Two
===
If there are any syntax errors in a javascript function, it appears to not register that function.

The problem is, there is no easy way to debug that problem via the vxml interpreter. So the best way was to build a simple html page and access the functions with it until all the syntax errors have been found.

Post Reply