I am having a touch screen with some very basic html pages. But if there is no activity for maybe 5 minutes, it should reload the main page again. So if I the main index.html page where there are links to siteb.html and sitec.html - it should after few minutes without activity load main.html again, even if standing on sitec.html
So it is not just a refresh of the site, but a load of the main page if there is no activity
Is there any scipt for this or an example I can try and test ?
<!DOCTYPE html>
<html>
<body>
<input type="text">
<button onclick="myFunction()">Reload page</button>
<script>
function myFunction() {
location.reload();
}
</script>
</body>
</html>
You can use following code also which includes time interval that means after 300 seconds page will be refreshed.
setInterval(function() {
window.location.reload();
}, 300000);
Related
This is what I got so far:
<audio id="player" src="../media/Click.mp3"></audio>
<div>
Home
</div>
Instead of playing the audio first and then going on to the page, it just goes to the next page. What do I need to change? If I change the a href to # instead of index.html it will play the audio.
I would personally put a delay on the hyperlink. For example, a 5 second delay - so that when the button is clicked, the audio would play (during the delay) and then take the person to the link specified.
For example:
<html>
<head>
<!-- This is where the delay is specified -->
<script>
function delay (URL) {
setTimeout( function() { window.location = URL }, 5000 );
}
</script>
</head>
<body>
<!-- This is where the audio file is specified -->
<audio id="player" src="../media/Click.mp3"></audio>
<!-- The hyperlink is specified via the javascript delay -->
<div>
Home
</div>
</body>
</html>
Please note: In the example above, the delay is set to 5 seconds (5000 milliseconds). This can be changed according to the amount of time you want the user to hear the audio. Also, in the href, change the /index.html to the destination page, but ensure that the URL is specified within the apostrophes, e.g. 'URL'.
Hope this helps.
I think i am going crazy with this... there should be something that i am missing.
I have a html page that prints a lot of links in sequences... like this:
link1
link2
link3
...
The issue is that for some strange reasons when i click a link, the current page refresh while it's loading the content... and it's terribile because It needs to reload again all the links...
I have tried also this:
link1
but still whenever I click the current page it refreshes (while it is still loading) starting again from zero
I am using chrome latest version on win 10
Any clues? What else could i do to avoid refreshing the current page ?
The only woraround i found is to intercept the closing with the message box:
<script type="text/javascript">
window.onbeforeunload = function() {
return false;
}
</script>
use preventDefault() method
function openBlankPage(event,href) {
event.preventDefault();
alert('Opening the link')
window.open(href,'_blank');
}
<!DOCTYPE html>
<html>
<body>
<a href="#" onclick="openBlankPage(event,'https://www.google.hu/?gws_rd=ssl');">
Go to google.com not refresh</a>
<p>The preventDefault() method will prevent the link above from following the URL.</p>
</body>
</html>
I have used <meta http-equiv="refresh" content="10;url=https://www.test.com /> but i have to cancel it if
<button>Finsh</button> finish button is clicked.But this code refreshes in every 10 sec i am using the tool where javascript is also not supported.Can i cancel the time which i setted using meta tag..??
Use JavaScript to refresh the page every ten seconds in the first place.
<script>
timerID = setInterval(function() {location.reload();},10000);
</script>
<body>
<button id="button" onclick="clearInterval(timerID);">
Stop refreshing
</button>
</body>
Have a look here.
Hope this helps! :)
Using HTML - Wondering if it's possible using Javascript, CSS or anything else to hide the video (Embedded mp4 on autoplay) after it is finished, or after an amount of time? Cheers for any help, if there's no way I'll find some other way.
You can use setTimeout() and SomeElement.style.display="none" together.
<!DOCTYPE html>
<html>
<head>
<script>
setTimeout(hideDiv, 10000); //Instead of 10000 put your video's length, in milliseconds
function hideDiv() {
document.getElementById("toHide").style.display="none";
}
</script>
</head>
<body>
<div id="toHide">
<p>Your video here</p>
</div>
</body>
</html>
In the example above, the div with id toHide disappears after 10 seconds. Simply place your video inside of the div. To change the time after which the div disappears, change the "10000" in setTimeOut() to your video's length, in milliseconds.
I want to reload my text about every 5 seconds, so that my users see that they have new mail... My code looks like this:
If C_Mess "0" Then <span class="message-count"> C_Mess </ span> Else 0 End If
Can anyone help me to reload this every 5 seconds or something? Javacript / jQuery or whatever.
I want to refresh <span class="message-count"> C_Mess </ span>.
Very grateful for answers.
<html>
<head>
<!-- For ease i'm just using a JQuery version hosted by JQuery- you can download any version and link to it locally -->
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
var refreshId = setInterval(function(){
$('#responsecontainer').fadeOut("slow").load('response.php').fadeIn("slow");
}, 5000);
</script>
</head>
<body>
<div id="responsecontainer">
</div>
</body>
I would place the following inside of a setTimeout function:
$(".message-count").hide().html('the new message count').fadeIn('fast');