dnn
dnn

Reputation: 57

Button to temporarily disable/stop meta tag refresh?

I have a php script in which there is a meta tag which refreshes a part of the script (checking connectivity of an IP). While it does it, it outputs some status text like "checking connectivity, 5/10 retries".

I've added a stop-button to the end of that, so I can stop the refresh-procedure mid-way if i need to. Problem is that it only seems to stop the current "load", not the whole refresh-procedure.

How can I make it temporarily disable/stop the refresh?

This is a code snippet from the php script:

function htmlheader( )
{
global $device, $frame, $tries, $maxtries, $status, $pageurl, $timeout;
// global "custom" header settings
$content = "<TITLE>PHP WoL ($device) - by PRThomasUK </TITLE>\n";
//generate refresh header for frame2.
if ( $status == 0 ) {
$content .= "<META HTTP-EQUIV=\"refresh\" CONTENT=\"$timeout;url=$pageurl?&tries=$tries\">\n";
}
return $content;
}
// function htmlheader( ) - Returns HTML content for mainpage, frame1 & frame2 based on value of $frame.
function htmlcontent( )
{
global $pageurl, $device, $deviceip, $deviceport, $devicemac1, $devicemac2, $frame, $tries, $maxtries, $status;
if ( $frame == 1 ) {
if ( $status == 0 ) {
$content = "<script type=\"text/javascript\">function stopFrameload() { window.stop(); document.execCommand(\"Stop\");}</script>\n";
$content .= "<p>Checking connectivity... ($tries/$maxtries) &nbsp;&nbsp;&nbsp<a href=\"\" onclick=\"stopFrameLoad(); return false;\">Stop</a></p>\n";
}

This is the JS isolated:

<script type="text/javascript">
function stopFrameload() {
window.stop();
document.execCommand("Stop");
}
</script>

And the actual line thats outputted:

<p>Checking connectivity... ($tries/$maxtries) &nbsp;&nbsp;&nbsp<a href="" onclick="stopFrameLoad(); return false;">Stop</a></p>

Upvotes: 0

Views: 640

Answers (1)

M8R-1jmw5r
M8R-1jmw5r

Reputation: 4996

How can I make it temporarily disable/stop the refresh?

By not outputting the META tag in the first place.

Upvotes: 2

Related Questions