【发布时间】:2013-08-01 21:40:58
【问题描述】:
一直在表单的Thankyou页面上使用以下内容在 5 秒内重定向回表单,并用值巧妙地预先填写名称字段:
<script> setTimeout(function() {location.href = '<?php echo $var3['returnurl'] ?>?fullName[first]=<?php echo $var1['first'] ?>&fullName[last]=<?php echo $var2['last'] ?>'}, 5000); </script>
在 returnurl 字段是 https:// url 之前效果很好。 然后它会停留在thankyou页面上,循环尝试进行重定向。 没有涉及 iframe .... 尝试过 top.location.href ...不好...甚至尝试过 location.replace
任何人都可以看到可能影响重定向到 https:// url 的代码的任何限制。
php 文件中的代码...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="width">
<title>Thankyou</title>
<style type="text/css">
body
{
margin: 0px;
padding: 0px;
background: #fff;
font-family: Arial;
}
#message
{
position: absolute;
left: 50%;
width: 320px;
margin-left: -160px;
}
</style>
<?php
$answers = $_POST;
$var1 = array("first" => $answers[fullname][0]);
$var2 = array("last" => $answers[fullname][1]);
$var3 = array("returnurl" => $answers[returnurl]);
?>
</head>
<body>
<script>
setTimeout(function() {location.href = '<?php echo $var3['returnurl'] ?>?fullName[first]=<?php echo $var1['first'] ?>&fullName[last]=<?php echo $var2['last'] ?>'}, 5000); // this duration is in millisecs
</script>
<div id="message">
<p> </p>
<div style="text-align: center;"><h1>Thank You!</h1></div>
<div style="text-align: center;">Your submission has been received.</div>
<div style="text-align: center;">We're most grateful</div>
<div style="text-align: center;"> </div>
<div style="text-align: center;"><img src="http://www.mazeguy.net/bigsmilies/thumbsup.gif"></img></div>
<div style="text-align: center;"> </div>
<div style="text-align: center;">You will return in 5 seconds</div><br />
</body>
</html>
这是提交的结果...Thankyou 页面源显示...是的,安全页面 url 没有通过 ....
<script>
setTimeout(function() {location.href = '?fullName[first]=&fullName[last]='}, 5000); // this duration is in millisecs
</script>
【问题讨论】:
-
请向我们展示呈现的 HTML。
-
脚本实际上是这样嵌入页面的还是只是为了我们的可读性?我的意思是它是否像
-
@Rooster 这很可能是内联在他的 .php 文件中。
-
@Mark $var3['returnurl'] 的值是多少?
-
查看页面的
view-source:,看看生成了什么代码
标签: php javascript