2

I asked this sort of question before ( Application fails to dynamically _re_load JavaScript files ) but I couldn't quite resolve the problem (if it has any solution), so I will put this in another fashion, a simpler one:

Can one unload a file from the browser's memory for posterior reloading?
(Removing the tag is not enough apparently.)

Or more relevant, if a reinsert the tag after removing it, is that code rerun (apparently not)?

How can accomplish the latter?

Thanks in advance.

0

2 Answers 2

1

You could generate a random number and then attach it to the end of the filename like this: .../script.js?r=0.25300762383267283. Then the browser would think it's a new file and not reference it from the cache.

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

1 Comment

I think that helped somehow. Noticed something though: stackoverflow.com/questions/1704979/re-insertion-of-script-tags The code seems to be rerun nevertheless, so mission accomplished and I guess some of the problems I had were not because of this but DOM related issues which I will check out now. Thanks Alexsander.
0

I don't think it is possible to unload a script file. As to the re-run issue, you could try giving each instance you call a JS file a varying GET parameter (e.g. the current timestamp). That might / should cause the browser to re-execute the file.

What are you trying to achieve? There may be smarter ways than re-loading a script file.

4 Comments

The given link shows a given use case for what I am trying to do :)
?? I don't understand. Does that help you or not? And why do you open a 2nd identical question? stackoverflow.com/questions/1704979/re-insertion-of-script-tags
@Pekka Gaiser: How are they duplicated? They are related, but not the same question.
@Pekka Gaiser: Thanks :) And your idea is pretty much the same as Alexsander Akers's I might add, so thanks for that too.

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.