View Full Version : Reload a js file and nothin else....
02-11-2004, 10:52 PM
Well, i just want to reload my js file nothing else
thanks for any help
02-12-2004, 02:23 PM
Ask in the DOM forum about inserting a "new" script tag. It may be possible to insert one and that would cause a copy of the script to be loaded but whether it would use a fresh copy retrieved from the server or the copy already cached is anyone's guess.
02-12-2004, 03:47 PM
How I would do it.
02-12-2004, 04:02 PM
I would personally wrap everything except global variable and function declarations in a function, and call that function again if needed, instead of trying to load the script again. There's no guarantee toward whether the file will be called from cache or reloaded at all, and there is no guarantee that the file will be executed again if it is in fact reloaded. Op7 before 7.5 did neither load the file, not execute the script if you wrote it into the file dynamically. Saf1.2 still does neither. Ie5m does only load the file if the script element is written through innerHTML instead of dynamically created.
02-12-2004, 04:49 PM
migth be me that are wrong here but reload ain't that simply when it calls the file from whatever source it find it at.
and refresh is when it force downloads a new copy of the requesten file? :)
anyway perhaps I should write 'IE6 Scripter ONLY' in my sig :)
02-12-2004, 10:35 PM
Well the thing is that when i just chage the src of the script element it doesnt execute the js file again.
then i have to reload the whole page.... which takes tooo long in some cases :)
02-12-2004, 11:22 PM
The src of scripts is read only for practical reasons. You have to create a new script element for it to load anew, in the browsers that does that.
02-13-2004, 12:05 AM
02-13-2004, 12:27 AM
For iew, moz and op7.5:
For Saf1.2 (only works on files in the same domain):
The saf code also works in moz, but may crash the browser in some cases.
02-13-2004, 11:01 PM
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.