use location.reload() to keep page scroll position

use location.reload() to keep page scroll position on page refreshes, but keep using location.href method for POST requests to avoid browser asking to resubmit data on reloads
This commit is contained in:
narspt 2018-02-02 20:26:33 +00:00 committed by GitHub
parent c392051987
commit 7ec97b2c9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 4 deletions

View File

@ -97,12 +97,19 @@ else {
<script>
var PageRefresh;
function ReloadPage() {
function ReloadPage() {';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
echo '
document.location.href = "./index.php';
if (isset($_GET['show'])) {
echo '?show='.$_GET['show'];
if (isset($_GET['show'])) {
echo '?show='.$_GET['show'];
}
echo '";';
} else {
echo '
document.location.reload();';
}
echo '";
echo '
}';
if (!isset($_GET['show']) || (($_GET['show'] != 'liveircddb') && ($_GET['show'] != 'reflectors') && ($_GET['show'] != 'interlinks'))) {