I tried this out and it would probably be simplest to pass the entire URL via javascript. Like this would be the top page:
Code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<script type="text/javascript">
document.write('<iframe src="child.htm?top=' + encodeURIComponent(location.href) + '" width="300" height="300" scrolling="auto" frameborder="1"></iframe>');
</script>
</body>
</html>
Change child.htm to the full path to the widget. Then on the widget page (the page in the iframe) have:
Code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<script type="text/javascript">
var topURL = unescape(location.search.split('=')[1]);
document.write('<a target="_top" href="' + topURL + '">Refresh</a>');
</script>
</body>
</html>
That should take care of it. This could also be done using the DOM to create these elements rather than document.write, and that would probably be better.
Bookmarks