0

Using yepnope.js. I need to "refresh" the script, but yepnope prevents files with the same url from being re-loaded.

In the documentation, they suggest using a plugin to allow files to refresh. Is there such a plugin available? What are my other options for refreshing a script during runtime in Javascript?

I tried appending a random number as a query argument to the url. That worked, but made it much more difficult to set breakpoints while debugging, so I'd rather not do this.

Any suggestions? Thanks!

1 Answer 1

1

IMHO it is not possible do that using any yepnope method.

I think you only has two possibilities:

  • Adding a random parameter to the querystring (your current solution)
  • Changing the yepnope script to:
    1. expose the scriptCache yepnope var
    2. reset the scriptCache[url]
    3. and finally remove the created DOM img node that has your url as src.
    4. In addition set the cache headers to expired, to prevent browser cache.

good luck

Sign up to request clarification or add additional context in comments.

2 Comments

Should I just add the script manually do you think? What is the way do it manually (without the use of yepnope)?
I thought that your need to reload the script using yepnope.Otherwise, if you can reload it without yepnope logic, use this: var s = document.createElement('script'); s.src = url; document.getElementByTagName('head')[0].appendChild(s);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.