Is it possible to submit a form and post some data on a meta refresh??
i have some html which i want to submit after 5 seconds but i dont want the user to have to click a submit button - is this possible?
I started some code below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="refresh" content="5;url=http://www.mysite.com" />
<title>Test Post</title>
<base href="http://www.mysite.com" />开发者_开发技巧
</head>
<body>
<form action="http://www.mysite.com" method="post">
<input type="hidden" name="fname" value = "paul"/>
<input type="hidden" name="age" value = "25"/>
</body>
</html>
I think the only way is to use javascript:
<script>
setTimeout(function() {
document.forms[0].submit();
}, 5000);
</script>
I would do this using javascript,, I don't believe that it is possible using meta refresh unless you paste it in the url as GET parameters.
I think you can only send data with get-Method, if you extend the url in the meta tag.
But keep always in mind:
The meta tag is one of the first what will be executed. Theorically you can edit the url by javascript, but you will need time for it. So you have to synchronise the waiting time and the execution time from javascript.
精彩评论