Re: use http-equiv to refresh the page
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Wednesday 06 November 2002 15:19, Eric L. Brine wrote: HTML 4.01 also has a section on META and http-requiv. However, the only reference to refresh is: Note. Some user agents support the use of META to refresh the current page after a specified number of seconds, with the option of replacing it by a different URI. Authors should __not__ use this technique to forward users to different pages, as this makes the page inaccessible to some users. Instead, automatic page forwarding should be done using server-side redirects. All the HTTP-EQUIV meta tags are relics from static HTML pages. The HTTP server (eg. Apache) reads meta tags from HTML pages and appends all meta tags with HTTP-EQUIV to outgoing HTTP headers. This feature is not available for dynamic content; dynamic pages must set their own headers. I'm guessing this is because http-equiv is designed to hold an HTTP header, but there is no such thing as an Refresh header in HTTP. There is a Refresh header in HTTP. It's syntax is the same as for the HTTP-EQUIV meta tag. So http-equiv=refresh is no longer standard. Of course, this is all theoretical. In practice, too many people are not easily swayed by a measily thing such as a standard. UAs are not required to deal with meta tags which contain HTTP-EQUIV content. Both Internet Explorer (at least 6, v6+ may also support them in quirk mode) and Netscape/Mozilla should interpret them if the server does not include them in the real HTTP headers. Some UAs don't do this, eg. Konqueror, and support for them might go away any time without notice, so it should not be used. The CGI module enables the programmer to add arbitrary HTTP headers with the syntax header( -type = 'text/html', -refresh = '0; url=http://www.address.com/' ); See 'perldoc CGI' for more information. -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE90OTjnksV4Ys/z5gRAhTxAJ9tv49KSvNt0JRbzf2Uws+wiOIM4ACfdzDX zhojTxLkGITTQT8MkAVACIg= =fQe4 -END PGP SIGNATURE-
Re: use http-equiv to refresh the page
No, that's server push you're thinking of. NPH (non-parsed header) scripts are CGI scripts that talk directly to the client without the server parsing headers and adding others (like the one that says it's Apache). My bad. It was. But I think one needs to use NPH scripts to generate server push documents, IIRC. Which is why I was thinking about it. Normally, mod_cgi adds the response line and certain other headers, so it parses your output. This is the same as using mod_perl with the PerlSendHeader option on. NPH script behave like mod_perl with PerlSendHeader off. Trust me, you want to leave all the VMS, EBCDIC, and MSIE weirdness related to sending headers in the right order, checking values, including extras for broken browsers, and the all-important CRLF-CRLF header separator, et al. to CGI.pm. Mike808/ - http://www.valuenet.net
RE: use http-equiv to refresh the page
I just wanted to mention that the meta tag as well as its http-equiv attribute are both official parts of the HTML standard and have been for quite some time. Yes and no. HTML 4.0 has a section on META and http-requiv. In it, it mentions that Some user agents support the use of META to refresh the current page after a specified number of seconds, with the option of replacing it by a different URI. and proceeds with an example. That sounds more advisory than part of the standard. But for the sake of argument, let's say it's part of the standard, and check what HTML 4.01 has to say. HTML 4.01 also has a section on META and http-requiv. However, the only reference to refresh is: Note. Some user agents support the use of META to refresh the current page after a specified number of seconds, with the option of replacing it by a different URI. Authors should __not__ use this technique to forward users to different pages, as this makes the page inaccessible to some users. Instead, automatic page forwarding should be done using server-side redirects. I'm guessing this is because http-equiv is designed to hold an HTTP header, but there is no such thing as an Refresh header in HTTP. So http-equiv=refresh is no longer standard. Of course, this is all theoretical. In practice, too many people are not easily swayed by a measily thing such as a standard. -- Eric L. Brine | ICQ: 4629314 [EMAIL PROTECTED] | MSN: [EMAIL PROTECTED] http://www.adaelis.com/ | AIM: ikegamiii
Re: use http-equiv to refresh the page
--- Perrin Harkins [EMAIL PROTECTED] wrote: I might be overzealous about this, but I dislike seeing HTTP-EQUIV meta tags used when actual HTTP headers are available to do the same thing. It's fine if there's a reason for it, but usually people do it because they don't realize they can just send a real header instead.. So what is the recommended way of doing wait pages ?? Sending a 302 wont definitely show the user anything other than all that text changing in the status bar. Mithun __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/
RE: use http-equiv to refresh the page
I just wanted to mention that the meta tag as well as its http-equiv attribute are both official parts of the HTML standard and have been for quite some time. Yes and no. Well, I disagree with the no. I will explain it again below. HTML 4.0 has a section on META and http-requiv. In it, it mentions that \Some user agents support the use of META to refresh the current page after a specified number of seconds, with the option of replacing it by a different URI.\ and proceeds with an example. That sounds more advisory than part of the standard. But for the sake of argument, let\'s say it\'s part of the standard, and check what HTML 4.01 has to say. HTML 4.01 also has a section on META and http-requiv. However, the only reference to \refresh\ is: \Note. Some user agents support the use of META to refresh the current page after a specified number of seconds, with the option of replacing it by a different URI. Authors should __not__ use this technique to forward users to different pages, as this makes the page inaccessible to some users. Instead, automatic page forwarding should be done using server-side redirects.\ I\'m guessing this is because http-equiv is designed to hold an HTTP header, but there is no such thing as an \Refresh\ header in HTTP. No, there is an HTTP header called Refresh, and it is standard. The meta tag and the http-equiv attribute of the meta tag are also standard. However, some people seem to be confusing HTTP and HTML here for some reason. Refresh is an HTTP standard, while the meta tag is HTML. The http-equiv attribute of the meta tag allows some HTTP headers to be specified in the HTML. While this feature offers little to mod_perl developers who can manipulate the headers themselves anyway, it was historically very helpful to developers for providing accurate HTTP headers such as Expires when they could not otherwise do this. The reason for that warning in the HTML specification is due to what the W3C likely considers a rampant abuse of the Refresh header which was not intended for redirection but only for refreshing the current resource. They are not warning against Refresh alone but rather what they consider a misuse of Refresh. The key phrase is, \with the option of replacing it by a different URI.\ This is what is frowned upon, not the meta HTML tag nor the Refresh HTTP header. So http-equiv=\refresh\ is no longer standard. Of course, this is all theoretical. In practice, too many people are not easily swayed by a measily thing such as a standard. Right, and this was my second point in an earlier message. Support for this rogue feature is pretty widespread, though it should not be completely trusted. As one of the other posters pointed out, there are Web clients that do not support the use of a meta tag for redirection, but many (possibly most) do. It is quite common to see the use of a meta tag for redirection accompanied by instructions on the screen and a link for users that are not automatically redirected. By accomodating the users who are not automatically redirected, you can eliminate the possibility of a dead-end. Of course, I hope that mod_perl developers always choose manipulating the real HTTP headers over the use of the http-equiv attribute of the meta tag. Also, it seems possible that there might be much wider support for redirection with the real Refresh HTTP header than for the meta tag equivalent. I know of at least one attempt to test and document support for this specific use: http://www.hixie.ch/tests/evil/mixed/refresh1.http.html Perhaps the results of this test can help a developer determine whether this misuse of the Refresh header is appropriate for a certain situation. Chris
Re: use http-equiv to refresh the page
On the use of META REFRESH tags, Chris wrote: It is also the only option for the pause, then redirect behavior the original poster desired that I can think of. I also seem to recall reading in the HTTP spec (and in Lincoln's CGI.pm code) that the use of a Redirect header in response to a POST request was specifically verboten. But, as was noted, everyone does it anyway and it works. Weiqi really needs to look at his apache logs, try running his CGI from the command line to see the exact output the browser sees. Of course, he'll have to manually perform the redirect :=) Use the lwp-request tools (GET and POST) to get live interaction with the webserver in question if running the CGI is not possible. Also, NPH is only implemented in the NS browsers, and was a way for a webserver to send multiple documents inline down to a browser, and was an ancient way to write status pages and such that automagically refreshed themselves. It was originally used as a primitive way to animate images. IE will display these pages as a single never-ending document separated by the headers. If you're running a long-running CGI and need the browser to keep the connection alive, you need to periodically (2 minutes for IE, but is browser specific) send something to the browser - like a waiting page that dribbles out whitespace until the document is ready. There are more complicated ways to do this as well, and that technique is dated to modern web users. In any case, I don't think the issue is a mod_perl one, but rather a CGI.pm one. BTW, Weiqi - there is a stlouis.pm perlmongers list. Mike808/ - http://www.valuenet.net
Re: use http-equiv to refresh the page
[EMAIL PROTECTED] wrote: Also, NPH is only implemented in the NS browsers, and was a way for a webserver to send multiple documents inline down to a browser, and was an ancient way to write status pages and such that automagically refreshed themselves. No, that's server push you're thinking of. NPH (non-parsed header) scripts are CGI scripts that talk directly to the client without the server parsing headers and adding others (like the one that says it's Apache). Normally, mod_cgi adds the response line and certain other headers, so it parses your output. This is the same as using mod_perl with the PerlSendHeader option on. NPH script behave like mod_perl with PerlSendHeader off. - Perrin
Re: use http-equiv to refresh the page
Wei Gao wrote: In my perl program executing in Apache web server, I have the following code: use CGI ; $query = new CGI ; $url = http://www.mycite.com ; #The url to refresh. print $query-header(-status='200 Ok', -type='text/html'); print htmlheadmeta http-equiv=\Refresh\ content=\0;URL=$url\ //head/html; Uh, that's not a redirect; that's an ugly proprietary hack. You should be using standard HTTP redirects. See http://search.cpan.org/author/JHI/perl-5.8.0/lib/CGI.pm#GENERATING_A_REDIRECTION_HEADER for more. - Perrin
Re: use http-equiv to refresh the page
Thanks. I have tried "print $query-redirect('http://somewhere.else/in/movie/land') ;" before, which works fine as to redirect the user to the web page. However, if the user then tries to refresh this page, the CGI script is called again without any params, which result in "Internal Server Error". So, the goal I want to achieve is that the user can refresh the page I returned without getting an error. It should refresh the web page, not calling my CGI script again. I also tried "print $query-redirect(-uri='http://somewhere.else/in/movie/land', -nph=1);" moments ago, which generated an "Internal Server Error" in IE window.Is using meta tag a "bad" approach? I thought this is a way to solve my situation here. Wei - Original Message - From: Perrin Harkins To: Wei Gao Cc: [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 2:50 PM Subject: Re: use http-equiv to refresh the page Wei Gao wrote: In my perl program executing in Apache web server, I have the following code: use CGI ; $query = new CGI ; $url = "<A" href="http://www.mycite.com">http://www.mycite.com ; #The url to refresh. print $query-header(-status='200 Ok', -type='text/html'); print "htmlheadmeta http-equiv=\"Refresh\" content=\"0;URL="$url\"" //head/html";Uh, that's not a redirect; that's an ugly proprietary hack. You should be using standard HTTP redirects. See http://search.cpan.org/author/JHI/perl-5.8.0/lib/CGI.pm#GENERATING_A_REDIRECTION_HEADER for more.- Perrin
Re: use http-equiv to refresh the page
Any time you see an Internal Server Error, you should be looking in your apache server's error_log file to see what exactly the error was. That will help you (and the list) figure out what's going wrong. Wes Wei Gao [EMAIL PROTECTED] on 11/05/2002 06:10:34 PM To:Perrin Harkins [EMAIL PROTECTED] cc:[EMAIL PROTECTED] Subject:Re: use http-equiv to refresh the page Thanks. I have tried print $query-redirect('http://somewhere.else/in/movie/land') ; before, which works fine as to redirect the user to the web page. However, if the user then tries to refresh this page, the CGI script is called again without any params, which result in Internal Server Error. So, the goal I want to achieve is that the user can refresh the page I returned without getting an error. It should refresh the web page, not calling my CGI script again. I also tried print $query-redirect(-uri ='http://somewhere.else/in/movie/land', -nph=1); moments ago, which generated an Internal Server Error in IE window. Is using meta tag a bad approach? I thought this is a way to solve my situation here. Wei - Original Message - From: Perrin Harkins To: Wei Gao Cc: [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 2:50 PM Subject: Re: use http-equiv to refresh the page Wei Gao wrote: In my perl program executing in Apache web server, I have the following code: use CGI ; $query = new CGI ; $url = http://www.mycite.com ; #The url to refresh. print $query-header(-status='200 Ok', -type='text/html'); print htmlheadmeta http-equiv=\Refresh\ content=\0;URL=$url\ //head/html; Uh, that's not a redirect; that's an ugly proprietary hack. You should be using standard HTTP redirects. See http://search.cpan.org/author/JHI/perl-5.8.0/lib/CGI.pm#GENERATING_A_REDIRECTION_HEADER for more. - Perrin (See attached file: C.htm) Thanks. I have tried "print $query-redirect('http://somewhere.else/in/movie/land') ;" before, which works fine as to redirect the user to the web page. However, if the user then tries to refresh this page, the CGI script is called again without any params, which result in "Internal Server Error". So, the goal I want to achieve is that the user can refresh the page I returned without getting an error. It should refresh the web page, not calling my CGI script again. I also tried "print $query-redirect(-uri='http://somewhere.else/in/movie/land', -nph=1);" moments ago, which generated an "Internal Server Error" in IE window.Is using meta tag a "bad" approach? I thought this is a way to solve my situation here. Wei - Original Message - From: Perrin Harkins To: Wei Gao Cc: [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 2:50 PM Subject: Re: use http-equiv to refresh the page Wei Gao wrote: In my perl program executing in Apache web server, I have the following code: use CGI ; $query = new CGI ; $url = "<A" href="http://www.mycite.com">http://www.mycite.com ; #The url to refresh. print $query-header(-status='200 Ok', -type='text/html'); print "htmlheadmeta http-equiv=\"Refresh\" content=\"0;URL="$url\"" //head/html";Uh, that's not a redirect; that's an ugly proprietary hack. You should be using standard HTTP redirects. See http://search.cpan.org/author/JHI/perl-5.8.0/lib/CGI.pm#GENERATING_A_REDIRECTION_HEADER for more.- Perrin
Re: use http-equiv to refresh the page
Wei Gao wrote: I have tried print $query-redirect('http://somewhere.else/in/movie/land') ; before, which works fine as to redirect the user to the web page. However, if the user then tries to refresh this page, the CGI script is called again without any params, which result in Internal Server Error. You lost me. If you redirect the user to http://mycite.com/, and then the user reloads, he should be reloading http://mycite.com/. I don't see any reason why that wouldn't work. Are you saying that reload in IE goes back to the URL that issued the redirect and reloads that? Even if it does, it should still be submitting the query string or POST data, although the user may get a pop-up asking if he wants to submit POST data again. Is using meta tag a bad approach? Yes. It's something that Netscape added to their browser, which others may or may not add to their browsers. It's not part of any HTTP spec and isn't guaranteed to work, even on totally correct web browsers. - Perrin
Re: use http-equiv to refresh the page
Thanks for the reminder. I think the reason that "print $query-redirect(-uri='http://www.mysite.com', -nph=1);" is not working, is because my program doesn't seem to know how to handle "nph". I am using Apach1.3.26 and Perl 5.6.1. I have "use CGI qw(:standard -nph) ;" at the beginning of the script. However, when I tried to use nph, the server complains about "Bad Header". Is there any known issues that the versions I use don't support nph? Am I missing something? Thanks. Wei - Original Message - From: [EMAIL PROTECTED] To: Wei Gao Cc: [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 3:19 PM Subject: Re: use http-equiv to refresh the page Any time you see an Internal Server Error, you should be looking in yourapache server's error_log file to see what exactly the error was. That willhelp you (and the list) figure out what's going wrong.Wes"Wei Gao" [EMAIL PROTECTED] on 11/05/2002 06:10:34 PMTo: "Perrin Harkins" [EMAIL PROTECTED]cc: [EMAIL PROTECTED]Subject: Re: use http-equiv to refresh the pageThanks.I have tried "print $query-redirect('http://somewhere.else/in/movie/land');" before, which works fine as to redirect the user to the web page.However, if the user then tries to refresh this page, the CGI script iscalled again without any params, which result in "Internal Server Error".So, the goal I want to achieve is that the user can refresh the page Ireturned without getting an error. It should refresh the web page, notcalling my CGI script again.I also tried "print $query-redirect(-uri='http://somewhere.else/in/movie/land', -nph=1);" moments ago, whichgenerated an "Internal Server Error" in IE window.Is using meta tag a "bad" approach? I thought this is a way to solve mysituation here.Wei- Original Message - From: Perrin Harkins To: Wei Gao Cc: [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 2:50 PM Subject: Re: use http-equiv to refresh the page Wei Gao wrote: In my perl program executing in Apache web server, I have the following code: use CGI ; $query = new CGI ; $url = "http://www.mycite.com" ; #The url to refresh. print $query-header(-status='200 Ok', -type='text/html'); print "htmlheadmeta http-equiv=\"Refresh\" content=\"0;URL="$url\"" //head/html"; Uh, that's not a redirect; that's an ugly proprietary hack. You should be using standard HTTP redirects. See http://search.cpan.org/author/JHI/perl-5.8.0/lib/CGI.pm#GENERATING_A_REDIRECTION_HEADER for more. - Perrin(See attached file: C.htm)
Re: use http-equiv to refresh the page
Is using meta tag a \bad\ approach? Yes. It\'s something that Netscape added to their browser, which others may or may not add to their browsers. It\'s not part of any HTTP spec and isn\'t guaranteed to work, even on totally correct web browsers. A meta tag is not something unique to Netscape nor the least bit uncommon. It is supported by all major Web browsers and has been for quite some time. While its use may be discouraged over a protocol-level redirect at times, it is appropriate for some situations and appears to be appropriate for what the original poster is trying to accomplish. As with any other HTML tag, the meta tag does not need to be part of an HTTP specification in order to be valid. Also, it is guaranteed to work on any compliant Web browser. HTML has its own specification, and the latest version describes the meta tag here: http://www.w3.org/TR/html4/struct/global.html#h-7.4.4.2 Sorry for disagreeing like this, but I am always afraid to see people being given incorrect information that might cause them difficulty. I hope this helps clarify. Chris
Re: use http-equiv to refresh the page
Chris Shiflett wrote: A meta tag is not something unique to Netscape I said it was added by Netscape, and I'm pretty sure it was, back in 1.1 or 2.0. As with any other HTML tag, the meta tag does not need to be part of an HTTP specification in order to be valid. Also, it is guaranteed to work on any compliant Web browser. HTML has its own specification, and the latest version describes the meta tag here: http://www.w3.org/TR/html4/struct/global.html#h-7.4.4.2 Look a little further down that page: /*Note.* Some user agents support the use of META http://www.w3.org/TR/html4/struct/global.html#edef-META to refresh the current page after a specified number of seconds, with the option of replacing it by a different URI. Authors should *not* use this technique to forward users to different pages, as this makes the page inaccessible to some users. Instead, automatic page forwarding should be done using server-side redirects./ I might be overzealous about this, but I dislike seeing HTTP-EQUIV meta tags used when actual HTTP headers are available to do the same thing. It's fine if there's a reason for it, but usually people do it because they don't realize they can just send a real header instead.. - Perrin
Re: use http-equiv to refresh the page
Perrin Harkins wrote: Chris Shiflett wrote: http://www.w3.org/TR/html4/struct/global.html#h-7.4.4.2 Look a little further down that page: /*Note.* Some user agents support the use of META http://www.w3.org/TR/html4/struct/global.html#edef-META to refresh the current page after a specified number of seconds, with the option of replacing it by a different URI. Authors should *not* use this technique to forward users to different pages, as this makes the page inaccessible to some users. Instead, automatic page forwarding should be done using server-side redirects./ I might be overzealous about this, but I dislike seeing HTTP-EQUIV meta tags used when actual HTTP headers are available to do the same thing. It's fine if there's a reason for it, but usually people do it because they don't realize they can just send a real header instead.. No, I actually agree with you completely on that last bit and am of the opinion that using the http-equiv attribute is a leftover habit from the early days of Web development when manipulating HTTP headers was not as convenient as it is now. I just wanted to mention that the meta tag as well as its http-equiv attribute are both official parts of the HTML standard and have been for quite some time. Netscape also introduced things like cookies and SSL, but that should in no way discredit the technology. The W3C's stance on refresh is the same for the header as well as the meta tag: they did not originally intend for it to be used to specify a *different* URL as a rudimentary method of redirection. They meant it to be used to refresh the current resource only. However, this rogue practice of redirection is quite common with both the header and the meta tag and is very well supported by browsers. In fact, I am not aware of any Web client that supports refresh but also limits the URL to the current resource only. It is also the only option for the pause, then redirect behavior the original poster desired that I can think of. Chris
Re: use http-equiv to refresh the page
Wei Gao wrote: Thanks for the reminder. I think the reason that print $query-redirect(-uri='http://www.mysite.com', -nph=1); is not working, is because my program doesn't seem to know how to handle nph. I am using Apach1.3.26 and Perl 5.6.1. I have use CGI qw(:standard -nph) ; at the beginning of the script. However, when I tried to use nph, the server complains about Bad Header. Is there any known issues that the versions I use don't support nph? Am I missing something? I don't think NPH is related to the problem you're having, but Apache determines if a script is NPH by looking at the prefix of the file. Try naming your script nph-something.cgi and it should support NPH. This is not very well documented, unfortunately. You don't need to use an NPH script to make redirection work. It's also still not clear to me what isn't working for you. When I get redirected in IE and then reload the page, it reloads the page I was redirected to. Since this is all getting pretty far off topic for the mod_perl list, you might want to try asking on a CGI-specific list or on http://perlmonks.org/. - Perrin
Re: use http-equiv to refresh the page
Chris Shiflett wrote: I just wanted to mention that the meta tag as well as its http-equiv attribute are both official parts of the HTML standard and have been for quite some time. Netscape also introduced things like cookies and SSL, but that should in no way discredit the technology. I'm just bitter about Netscape because I worked at a company that made me use frames and JavaScript when the 2.0 version came out. It is also the only option for the pause, then redirect behavior the original poster desired that I can think of.. It is the only way I know to do that, but I didn't think that's what he was trying to do. He had a wait time of 0 in his example. - Perrin