Advanced Search

Page 3 of 3 FirstFirst 123
Results 21 to 30 of 30

Thread: Timed Redirect

  1. #21
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by blm126
    I have found the w3 specs,
    The W3C? They don't publish HTTP specifications. That's down to the Internet Engineering Task Force (IETF) through the Request For Comments (RFC) document series, though some of the same people are involved. The W3C do have links and copies of some of the relevant RFCs, though.

    but I'm looking for a list of what different browsers support.
    I don't know of any such lists, but HTTP is vast. Moreover, it's a network protocol, so it's not just browsers that are significant: there may be any number of intermediate HTTP client/servers along a particular route, acting as proxies or caches, and their behaviour is important, too. I'd be more interested to know about those, and if they're that (or at all) prevelant.

    It might be possible to check "manually" using OPTION and TRACE requests, and the Max-Forwards header in a similar fashion to trace route programs.

    In all, though, client behaviour is reasonably good. There are some issues with caching (some of which can be read about in RFC 3143), redirection (see the link to Alan Flavell's article in a previous post), and Content-Type header handling (notably that some browsers try to second-guess the value), but following the specification unconditionally (see the definition in 1.2 Requirements in RFC 2616) should help avoid a lot of problems.

    Of all browsers, I should think that MSIE is the most badly behaved, so if you get something behaving properly with it, you shouldn't have trouble elsewhere.

    I have never really spent the time to learn that much about http,
    If you do, or plan to control server behaviour with server-side languages, then in my opinion, knowledge of HTTP (preferably both 1.0 [RFC 1945] and 1.1) is a must. Ignorance of it can mean that you cause the server to behave badly. It's also the cause of programming by mystical incantation: people not understanding how things work, so they try all manner of convoluted schemes in an attempt to hack out the desired behaviour.

    ... I see a lot of interesting things you can do with it.For example the 204 No Content and 205 Reset Contents status codes look useful.
    I don't remember how well-supported 205 is, but you should be careful with both: when a user submits a form (the most likely time you'd use either in a response), it may not be obvious to them that the submission succeeded as nothing visual (or at least very little) will change. However, 204 is useful with back-end code (including AJAX) to indicate success when there's no entity to return.


    Quote Originally Posted by Twey
    [On the usefulness of 410 Gone] I understand that.
    I know you do. It was some general musing on my part (though I'm sure I've written the same previously).

    Mike

  2. #22
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Quote Originally Posted by mwinter
    The W3C? They don't publish HTTP specifications. That's down to the Internet Engineering Task Force (IETF) through the Request For Comments (RFC) document series, though some of the same people are involved. The W3C do have links and copies of some of the relevant RFCs, though.
    My mistake, I was doing a search on google and w3.org came up. I should try not to make hasty assumptions like that.

  3. #23
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Sorry for the double post
    Quote Originally Posted by mwinter
    I don't remember how well-supported 205 is, but you should be careful with both: when a user submits a form (the most likely time you'd use either in a response), it may not be obvious to them that the submission succeeded as nothing visual (or at least very little) will change. However, 204 is useful with back-end code (including AJAX) to indicate success when there's no entity to return.
    I was unable to find any compatibility test results, so I decided to devise my own. From what it is looking like firefox supports 204 but treats 205 like 204. Opera treats both like 200, just like IE. I was wondering if you could confirm that this is a good test?
    Code:
    <html>
    	<head>
    	<title>205 and 204 test</title>
    	</head>
    	<body>
    	<form action="205.php" method="get">
    	205
    	<input type="text" name="test">
    	<input type="submit" name="sub">
    	</form>
    	204
    	<form action="205.php" method="get">
    	<input type="text" name="test">
    	<input type="submit" name="sub">
    	</form>
    	</body>
    </html>
    205.php
    PHP Code:
    <?php
    header
    ('HTTP/1.1 205 Reset Content');
    ?>
    204.php
    PHP Code:
    <?php
    header
    ('HTTP/1.1 204 No Content');
    ?>

  4. #24
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    From what it is looking like firefox supports 204 but treats 205 like 204.
    I would agree with that...

    Opera treats both like 200, just like IE.
    ...but you've drawn the wrong conclusion, here. Both support 204, but don't understand 205. If the 205 response had an entity, they would display it (so it is like 200 in that sense), but as such a response cannot, that detail is irrelevant.

    I was wondering if you could confirm that this is a good test? ...
    It gets the job done, though I wouldn't (and didn't) use separate files.

    Mike

  5. #25
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Well, thanks for all your help. I am going to continue learning (and experimenting) with HTTP.

  6. #26
    Join Date
    May 2013
    Location
    Southampotn
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,
    I have tried your code, in my site (not yet running) but with problems, Where is the code placed into my code ? I have tried above the footer and also at the beginning of the body.. In fact I had to scrap the page and replace with a copy, (lucky me)
    I'm a total beginner with java and php.

  7. #27
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,684
    Thanks
    43
    Thanked 3,128 Times in 3,094 Posts
    Blog Entries
    12

    Default

    PHP headers have to be sent before any content is written to the page. An HTML <meta refresh tag should be one of the first things in the head of the page. A javascript that sets a timeout to change the page can go just about anywhere.

    If your host supports PHP, that should be all you need, works in all browsers.

    If you're still having problems, show us your code.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #28
    Join Date
    Jun 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Do I use both Java with PHP or the only PHP code is sufficient for the redirect. It getting some confusion
    Last edited by jscheuer1; 06-04-2013 at 05:44 AM. Reason: remove spam links

  9. #29
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,882
    Thanks
    16
    Thanked 288 Times in 287 Posts
    Blog Entries
    4

    Default

    (JavaScript, not Java - Java is something different)

    If you can use php, use only the php redirect - that's the most reliable/fastest option.

    If you can't use php, use both the JavaScript and meta tag redirect.
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  10. #30
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,684
    Thanks
    43
    Thanked 3,128 Times in 3,094 Posts
    Blog Entries
    12

    Default

    Java and javascript are two different things. Java is a server side language, javascript is client side.

    There is no Java involved here. However, it could be used. What we are talking about in this thread are PHP, HTML, and javascript. Anything that can send a header to the browser, or otherwise trigger a redirect for it can be used to try to do this. Java can send headers. However, in this case it would be overkill. Unless the page is already Java based, there's no sense in using it just for this.

    Javascript and HTML are client based - rely solely upon the user's browser in order to perform. Some browsers can turn off the HTML based meta tag redirects, all can turn off javascript, which would disable any javascript timeout redirect. Only something server side, like PHP can send a redirect to the browser that it cannot, at least not under most circumstances, ignore.

    But the whole point of having a message like:

    Your specified action is being performed. Your browser will be redirected in a few moments. If not, click here.
    that's linked to the desired page, is just in case the redirect doesn't work.

    And, as I previously stated, if PHP is available on your host, it's all that you need. But, also as previously stated, it's redirect header must come before anything is written to the page.
    Last edited by jscheuer1; 06-04-2013 at 06:11 AM. Reason: spelling
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •