#1660 posted by
rj on 2013/03/04 19:04:56
that was chrome, but it prompted first. don't know why i clicked yes
Feature Request
#1661 posted by
Spirit on 2013/03/05 20:10:35
metl, could you make an anchor in view_thread.php right after the top-most pagination before the first rendered post? And then point to that in "New X" links.
Would save at least 42 milliseconds of scrolling whenever one visits posts with long main posts. ;)
#1664 posted by
metlslime on 2013/03/14 08:00:53
So Firefox (and every other browser once upon a time) lets you refresh without posting, Chrome offers to resubmit the form. I'm not sure why it offers that, since i use a redirect to help clear out the form data (so that people can refresh the page without worries.) Chrome is just too clever; I guess i'll need to find another way.
#1665 posted by
Spirit on 2013/03/14 08:35:08
It's amazing and sad how many people seem to click yes without thinking though. I hope they don't do that for java applets.
One Common Solution
Is to store a magic value in the session and in a hidden form field. On submit, the session value is removed. If the session value is missing, nothing gets posted.
#1668 posted by
RickyT33 on 2013/03/14 08:53:42
Or manually kill the $POST vars after submission maybe.... ?
#1669 posted by
JneeraZ on 2013/03/14 20:02:00
It's amazing and sad how many people seem to click yes without thinking though. I hope they don't do that for java applets.
To be fair, that's what happens when too many things ask too many stupid questions. You condition people to click YES out of reflex.
#1670 posted by
deqer on 2013/03/15 05:57:13
You may already have tried this, or already have this. But, try putting "exit;" after your header("Location: ") redirect.
Sleepwalkr
#1673 posted by
metlslime on 2013/03/15 07:42:47
not sure why it can happen, but this means you loaded the page with one IP address, but when you submitted your post you had a different IP.
Maybe it happens on mobile phones more because they can change networks frequently? (edge <-> 3g <-> wifi)
Okay
I understand. I'm at home where I'm in my wifi, but sometimes it switches to mobile broadband for some reason. Thanks!
Deqer:
#1675 posted by
metlslime on 2013/03/15 08:09:49
i can see how that might help, as my php still generates the entire page after you post.
I wonder if chrome is ignoring the redirect because it's the same URL? In that case i could use a second URL as the post target and then redirect back to view_thread.php.
Good Guess
#1676 posted by
mwh on 2013/03/19 08:54:12
Ah Good...
#1677 posted by
metlslime on 2013/03/19 09:15:19
i'll just do nothing then :)
(though adding an "exit" to my php after the redirect still sounds like a good idea to save server resources)
#1678 posted by
deqer on 2013/03/19 09:33:24
Although it's a bug and that it's being addressed, it's still too late.
Not many people will bother to upgrade their Chrome to latest version--we've seen that habit with IE users.
Simply adding several lines of javascript, and you'll be able to convert your "Post A Reply" < form > to use Ajax.
By looking at your HTML code, I can see that you are using javascript without any libraries such as mootools, jquery, etc. -- which is fine, you can still do ajax with plain javascript.
---
Just adjust your HTML slightly by adding an ID to the <td> that holds the "Post A Reply" form html.
Currently it is:
< td bgcolor="#333333" width="500" valign="top" >
< span class="header2">Post A Reply:</span >
...
< /td >
Change the < td > to have id="post-a-reply"
So, you then have < td bgcolor="#333333" width="500" valign="top" id="post-a-reply" >
Then, the javascript would be:
On submit:
var xmlhttp;
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else { // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById("post-a-reply").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("POST","http://celephais.net/board/view_thread.php?id=2&start=1676&ajax=1",true);
xmlhttp.send();
---
Notice I added another parameter "&ajax=1" to the submit URL, and you can use that in PHP to spit out a specific response for the update to the < td >, rather spit the entire page as if there was no ajax.
Obviously the "id=2&start=1676" part is dynamic, of course.
#1679 posted by
deqer on 2013/03/19 09:35:04
Hmm, that one line got garbled. It changed my quotation character to "&quo..." Let's try again:
xmlhttp.open("POST", "http://celephais.net/board/view_thread.php?id=2&start=1676&ajax=1" ,true);
Ahhh, whatever.
#1680 posted by
Spirit on 2013/03/19 10:09:28
Chrome updates automatically.
Yup
Deqer, this is a veey change-averse group ;-)
#1682 posted by
deqer on 2013/03/19 16:45:14
Still doesn't hurt to add some ajax to the site. Ajax has been available and supported for 10+ years now. Saves on resources, too.
It's 2013. Get with it.
Metl
#1683 posted by
Spirit on 2013/03/19 16:49:14
Please don't. Javascript is bloody annoying.
Yes
Please don't, and it's not necessary at all. You can protect against double posts entirely on the server.