Reputation: 785
I want to redircet to another page by meta refresh, but only after all resources were loaded. Any ideas how to archive that?
SOLUTION:
I combined both ways, the meta refresh and the jQuery way.
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="pos" uri="/WEB-INF/tld/pos.tld" %>
<%@ taglib prefix="template" tagdir="/WEB-INF/tags" %>
<%@ page pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="description" content="" />
<meta http-equiv="Refresh" content="1; url=${callback}/" />
<script type="text/javascript" src="/JS/pos_js/jquery-latest.js"></script>
</head>
<body>
<script>
$(document).ready(function() {
window.location = '${callback}';
});
</script>
</body>
</html>
With this way, for me, it is possible to redirect if the document in fully loaded and if JS is deactivated the meta refresh will throw the user to the callback page.
Upvotes: 0
Views: 2121
Reputation: 10713
Only real
way of doing it is:
<meta http-equiv="Refresh" content="1500; url=http://www.example.com/" />
That will wait 1.5 seconds for the page to load... not ideal, but without JS you'll be lucky!
edit: What about an iFramed option?
Upvotes: 3
Reputation: 48547
You could do this via jQuery using the $(document).load()
function.
$(document).load(function() {
window.location = 'http://new.url.com';
});
Upvotes: 2