Hello,
I have been searching around the net looking for solutions to my problem, but none have worked. My issue is that when i redirect using:
<meta http-equiv="Refresh" content="0; url=<?php echo $URL; ?>">
The hash tag part of URL gets removed by IE. So example.com/sample#foo will just load as example.com/sample. This happens in all version of IE and appears to be a bug, but the question is how do I get around this issue?
Here is the redirect page template for wordpress that I am using:
<?php
/*
Template Name: Redirect
*/
?>
<?php if (have_posts()) : the_post(); ?>
<?php $URL = get_the_excerpt(); if (!preg_match('/^http:\/\//', $URL)) $URL = 'http://' . $URL; ?>
<!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="Refresh" content="0; url=<?php echo $URL; ?>">
</head>
<body>
</body>
</html>
<?php endif; ?>
I understand the hash tag is a client side thing so I have tried the following things with javascript in the head:
<script type="text/javascript">
var theurl = "<?php echo $URL;?>";
// Redirect to hash if there is no hash in the URL.
if (window.location.hash == '') {
window.location.replace(theurl);
}
</script>
OR just:
<script type="text/javascript">
window.location.hash = window.location.hash;
</script>
None of these work, so I am thinking I might need to use a cookie method to solve this but I am unsure of how this would be implemented in my particular case.
Thanks in advance!