473,378 Members | 1,447 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Reload all included javascript src

Hi everyone,
is there a way to reload all external scripts each 60 sec? By external
I mean on

<script src="status.php" type="text/javascript"></script>

so lets say that I have several includes of scripts in a HTML page and
is there a way to reload it each 60 sec? I know I can do this by AJAX,
but can it be done this way?

May 17 '07 #1
7 4096
Hrvoje Vencl said the following on 5/17/2007 4:21 PM:
Hi everyone,
is there a way to reload all external scripts each 60 sec? By external
I mean on

<script src="status.php" type="text/javascript"></script>

so lets say that I have several includes of scripts in a HTML page and
is there a way to reload it each 60 sec? I know I can do this by AJAX,
but can it be done this way?
Yes. And, I can do it more reliably than AJAX can because AJAX would
require the same technique but adds the overhead of an XHR request that
I don't need to do.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 17 '07 #2
Hi Randy,
can you write here a simple script that would do that job? In that
called script I only use:

document.write('some html code here');

Thanks!

May 19 '07 #3
Hrvoje Vencl said the following on 5/19/2007 8:07 AM:
Hi Randy,
Umm, hi.
can you write here a simple script that would do that job?
To do what job? Quote what you are replying to so people know what you
are referring to.
In that called script I only use:

document.write('some html code here');
Executing that script one time after the page loads would be the limit.
After the page loads, if you document.write to the page then it replaces
the current page. So, the only thing that would be in your page is the
html in the string you wrote. If you want to be able to continuously
execute the script without destroying the current page you need to use
something like DynWrite from the FAQ. Then, wrap it in a function and
simply call the function, end of problems. No need to try to keep
"reloading all included script files".

Just to answer the question, search the archives for loadJSFile and you
can find many different variations of a function that will load .js
files on the fly. You would simply have to loop through the script tags,
pick up the src attribute, and loadJSFile load the file again.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 19 '07 #4
Thanks,
but I think I will re-write it to ajax, as it will take less time for
me to do it like that.
Randy Webb je napisao/la:
Hrvoje Vencl said the following on 5/19/2007 8:07 AM:
Hi Randy,

Umm, hi.
can you write here a simple script that would do that job?

To do what job? Quote what you are replying to so people know what you
are referring to.
In that called script I only use:

document.write('some html code here');

Executing that script one time after the page loads would be the limit.
After the page loads, if you document.write to the page then it replaces
the current page. So, the only thing that would be in your page is the
html in the string you wrote. If you want to be able to continuously
execute the script without destroying the current page you need to use
something like DynWrite from the FAQ. Then, wrap it in a function and
simply call the function, end of problems. No need to try to keep
"reloading all included script files".

Just to answer the question, search the archives for loadJSFile and you
can find many different variations of a function that will load .js
files on the fly. You would simply have to loop through the script tags,
pick up the src attribute, and loadJSFile load the file again.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 20 '07 #5
Hrvoje Vencl said the following on 5/20/2007 3:18 PM:
Thanks,
but I think I will re-write it to ajax,
If you want to make it harder than it has to be, that is your choice.
as it will take less time for me to do it like that.
I doubt it will take less time as you are going to have to do some
things either way and the ajax approach adds more to it.

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 20 '07 #6
I already use AJAX on site so this will only need to copy/paste some
code from 'js' do 'ajax' display. Thanks anyway.
Venki
Randy Webb je napisao/la:
Hrvoje Vencl said the following on 5/20/2007 3:18 PM:
Thanks,
but I think I will re-write it to ajax,

If you want to make it harder than it has to be, that is your choice.
as it will take less time for me to do it like that.

I doubt it will take less time as you are going to have to do some
things either way and the ajax approach adds more to it.

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 21 '07 #7
Hrvoje Vencl said the following on 5/21/2007 8:21 AM:
I already use AJAX on site so this will only need to copy/paste some
code from 'js' do 'ajax' display. Thanks anyway.
Considering that you can't interleave your replies properly even when
explicitly shown how to do it, I doubt you are in a position to even
know whether it is simple. I know, beyond any doubt, that the use of
Ajax to do what you asked about is more work than what I suggested
because you are going to have to do what I suggested to get the ajax
part to work.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 21 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: jbj | last post by:
Something like a php function that can be called? I have php in a page that needs to be update periodically (basically poll results) without reloading the page around it (I do have a button you...
1
by: Plasson | last post by:
<script language="JavaScript"> window.opener.location.reload(); setTimeout(window.close(), 5000); </script> I have this code in a popup in which I let user login using PHP (2 passages: insert...
1
by: zdhiu | last post by:
Hi javascript gurus, I have a simple html file (simple.html) with javascript. In html page there is sentence from variable defined in .js file (myFirst.js). Once I reload another .js file...
1
by: Marshall Dudley | last post by:
I need to be able to allow a user to submit a form which opens another window. This part I have working. But after the submit, I need to delay and have the original window do a reload. I cannot...
3
by: sentinel | last post by:
Hi all, I'm trying to reload a frame from a pop-up, but really cannot figure this out. Within my index.htm file, I make a link to call a pop-up frame with a javascript function that calls the...
19
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). ...
4
by: Stefan Mueller | last post by:
I've a webpage with a dynamically created table. If the user presses F5, clicks on the reload button, ... the webpage reloads and the dynamically created table will be resetted. Is there something...
2
by: nitinpatel1117 | last post by:
Hi, I wanted to know if there was a way to reload an external javscript file. Basially, what i have is a customised scrollbar, this scroll bar is created in javascript. and the source file is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.