简体   繁体   中英

JavaScript code not working in Safari

I have three pages:

Step1.php -> step2.php -> step3.php

As it shows, after submitting the step1.php it will go to step2.php

In step2.php there is JavaScript on the bottom, and it will automatically redirect to step3.php after 2 seconds.

<input type="hidden" name="queryString" id="queryString" value="<?php echo $_SERVER['QUERY_STRING'] ?>"/>
<script type="text/javascript">

    function redirection() {
        var queryString =document.getElementById("queryString").value;
        var reloadURL = "step3.php?"+queryString;
        location.href = reloadURL;
    }

        setTimeout("redirection()", 2000);
</script>

This forward flow is working in every other browser.

Now I am just clicking the back button of the browser from `step3.php page. Then it comes to step2.php and after 2 seconds it will go to step3.php .

But in Safari it doesn't work, it will get stuck on step2.php .

Any ideas?

Webkit browser are caching the last state of the last pages, as it was, when you left. Have you tried to use a meta tag instead. Don't know if this works, but worth a try:

<meta http-equiv="refresh" content="2;url=page2.php">

尝试此链接可能很有用http://www.php.net/manual/zh/reserved.variables.get.php ,这主要是因为问题在于将变量从Java脚本传递到地址栏

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM