a problem plugging document.location into a bookmarklet

K

kurt

greetings,
I'm working on a bookmarklet that needs to overwrite the current
document with a frameset where the src of one of the frames is the
current URL. What I've come up with works in Mozilla (Firefox 1.0pr).
But in IE6, though View Source shows that the new frameset is there
with the correct URL inserted, nothing displays. It's a white page.
Anyone see the problem/solution?

code:

javascript:void(docLocHref=document.location.href);document.write('<frameset
rows="100%,*"><frame src="'+docLocHref+'"></frameset>');

thanks in advace,
kurt
 
R

Robert

kurt said:
greetings,
I'm working on a bookmarklet that needs to overwrite the current
document with a frameset where the src of one of the frames is the
current URL.

I was able to get what you requested working in Netscape 7.2 too, but
not in IE 5.2.

I tried several approaches which are coded in frame2.html. I made a
button for each approach that I tried.

Maybe what I tried will be of some help to someone else figuring out
if this request is possible.

Robert

frames.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Frames Layout</title>
</head>
<frameset id="frameSetId" rows="50%,50%" border="0" frameborder="no" >
<frame src="frame1.html"
id="myframe1"
name="nameframe1"
scrolling=yes>
<frame src="frame2.html"
id="myframe2"
name="nameframe2"
scrolling=yes>
</frameset>
</html>


frame1.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Frame 1</title>

</head>

<body>
<p>This is frame 1.</p>

</body>
</html>


frame2.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Frame 2</title>
<script type="text/javascript">

function resizeFrame(percent)
{

var node = top.document.getElementById("frameSetId");
node.rows = percent;
}
function fullSize()
{

top.location.href = "frame1.html";

}

</script>

</head>
<body>
<p>This is frame 2.</p>
<form>
<input type="button"
name="activate"
value="Both frames at 50%."
onclick="resizeFrame('50%,50%');">
<input type="button"
name="activate"
value="Enlarge upper frame to 75%."
onclick="resizeFrame('75%,20%');">
<input type="button"
name="activate"
value="Enlarge upper frame to 100%."
onclick="resizeFrame('100%,0%');">
<br>
<input type="button"
name="activate"
value="display only frame1.html"
onclick="fullSize();">

<br><br>
</form>
<a href="frame1.html" target="_top">Link only to frame1.html</a>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top