/    Sign up×
Community /Pin to ProfileBookmark

page refresh link

I have a forum that I want to make a page refresh link (activated by user, not automaticallly), how would I go about doing this?

[URL=http://tec1.proboards19.com]Forum[/URL]

to post a comment
HTML

7 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceJan 04.2005 — Did you want a standard HTML link (i.e.. no JavaScript)? To do that, you'd need server-side code to generate a link to the page, itself, but with a random number attached to the URL to fool the server/client cache into re-retrieving a fresh copy of the page from your site. This number would have to change each time the page is refreshed.

Thus, server-side code method:
<i>
</i>&lt;a href="thispage.htm?id=99026345897164"&gt;Refresh&lt;/a&gt;

and JavaScript code method (or anything similar):
<i>
</i>&lt;a href="javascript&amp;#58;self.location.reload(true);"&gt;Refresh&lt;/a&gt;
Copy linkTweet thisAlerts:
@ray326Jan 04.2005 — You might also try

<a href="">Refresh</a>
Copy linkTweet thisAlerts:
@CharlesJan 04.2005 — [i]Originally posted by ray326 [/i]

[B]You might also try



<a href="">Refresh</a> [/B]
[/QUOTE]
With that you might want to use:

[font=monospace]<meta http-equiv="Expires" content="0">[/font]
Copy linkTweet thisAlerts:
@ksourceJan 05.2005 — [i]Originally posted by The Little Guy [/i]

[B]I have a forum that I want to make a page refresh link (activated by user, not automaticallly), how would I go about doing this?



[URL=http://tec1.proboards19.com]Forum[/URL] [/B]
[/QUOTE]


Try:

<head>

<script language="javascript">

<!--

function refresh()

{

window.location.reload( false );

}

//-->

</script>

<noscript>

<meta http-equiv="refresh" content="# of sec.">

</noscript>

</head>

<body>

<a href="javascript:refresh()">

<script language="javascript">

document.write("Refresh Link")

</script>

</a>

</script>

</body>


I will answer any questions you have if you dont get it.

Hope I helped. ?

-Kory
Copy linkTweet thisAlerts:
@phpnoviceJan 05.2005 — [i]Originally posted by ksource [/i]

[B]<script language="javascript">

<!--

function refresh()

{

window.location.reload( false );

}

//-->

</script>[/B]
[/QUOTE]

If you're going to use JavaScript, please note that the [B]false[/B] argument tells the browser, where possible, to reuse the local cached version of the page. As I previously posted, you must specify the [B]true[/B] argument to force the browser to actually send the request to the server for new content.
Copy linkTweet thisAlerts:
@The_Little_GuyauthorJan 05.2005 — I also am using this code to tell it where to place the link. I have to put this into the footer or the header, which one would be better?
<i>
</i>&lt;script&gt;
menuAdd = document.getElementsByTagName('td');
for (ma=0;ma&lt;menuAdd.length;ma++){
if (menuAdd[ma].className=='menubg'){
menuAdd[ma].innerHTML+='&lt;a href="tec1.proboards19.com"&gt;Refresh&lt;/a&gt;';
}}
&lt;/script&gt;


How would I combine the two codes?
<i>
</i>&lt;head&gt;
&lt;script language="javascript"&gt;
&lt;!--
function refresh()
{
window.location.reload( false ); // or true
}
//--&gt;
&lt;/script&gt;
&lt;noscript&gt;
&lt;meta http-equiv="refresh" content="# of sec."&gt;
&lt;/noscript&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;a href="java script:refresh()"&gt;
&lt;script language="javascript"&gt;
document.write("Refresh Link")
&lt;/script&gt;
&lt;/a&gt;
&lt;/script&gt;
&lt;/body&gt;

The body and head tag I can't mess with, because the program won't let me, but I can enter things into the headers, and footers, such as html, css and javascript.
Copy linkTweet thisAlerts:
@phpnoviceJan 05.2005 — [i]Originally posted by The Little Guy [/i]

[B]How would I combine the two codes?[/B][/QUOTE]

Change this:

menuAdd[ma].innerHTML+='<a href="tec1.proboards19.com">Refresh</a>';

to this:

menuAdd[ma].innerHTML+='<a href="javascript&#58;top.location.reload(true);">Refresh</a>';

The above change most closely duplicates the functionality of clicking the browser's Refresh/Reload button in the toolbar. However, I'm sure you're aware that some surfers keep JavaScript disabled because (among other reasons) of an unreasoning fear of it.
×

Success!

Help @The_Little_Guy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...