FRAME SRC="about:blank" oddities

I'm using <FRAME NAME="menu" SRC="about:blank" >... to create blank frames to fill dynamically using JavaScript.

At run-time, however, after JavaScript writes to the frame, the frame then fills itself with the referrring document.

If you press "back" you notice that indeed, the frame was written to, but there's this wierd little bit of code at the top of the frame which might have something to do with why the frame does not "hold."

<base HREF="http://myserver.com/documentbasedirectory/">

Anyone know what is going on here?  Is there a work-around that does not use the "about:blank" framesource tag?

I'm using NS 3.01

Many thanks,

Anthony Krinsky
askrinskyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

garikCommented:
Hi Anthony,
The BASE tag is not related to "about:blank" - try set frame source to real HTML page and you'll still get <base href=...> as soon as you write to the frame. Must be something with document.write.
But you can always override BASE reference by the one you need.
As to the frame filling itself with the referring document, I couldn't reproduce it in NS 3.01 - could you post some code which shows the problem?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
askrinskyAuthor Commented:
Hi Garrik --

Here's a snippet of my code.  Maybe it has something to do with the unescape() function that I'm using.

I'm mystified!

Anthony


<HTML><HEAD>
<SCRIPT language=javascript>
        pwin=window.open('','P');
        pwin.document.write('<FRAMESET COLS="100%" ROWS="59,*" noborder border="0">');
        pwin.document.write('<FRAME NAME="menu" SRC="about:blank" SCROLLING="NO" MARGINHEIGHT=0 MARGINWIDTH=0>');      
        pwin.document.write('<FRAME NAME="main" SRC="about:blank" SCROLLING="AUTO" MARGINHEIGHT=0 MARGINWIDTH=0>');
        pwin.document.write('</FRAMESET>');

        pwin.menu.document.close();
        pwin.menu.document.open();
        pwin.menu.document.write(unescape(document.preview_html.menu_preview.value));
        pwin.menu.document.close();
</script>
</HEAD>
<BODY>
<FORM name=preview_html>
<INPUT TYPE=HIDDEN NAME=menu_preview value="%3Chtml%3E%3Chead%3E%0A%3Cmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3Diso-8859-1%22%3E%0A%3Ctitle%3EIDAs%2FUSAs%20Proxy%20Menu%20Preview%3C%2Ftitle%3E%0A%3Cbody%20bgcolor%3D%22%23333399%22%20background%3D%22..%2F..%2Fmenus%2Fmenu_images%2Fm_id_bkgrnd.gif%22%20leftmargin%3D0%20topmargin%3D0%3E%0A%3Cp%3E%0A%3CCENTER%3E%3CFORM%3E%3CINPUT%20TYPE%3DBUTTON%20NAME%3Doksave%20VALUE%3D%22%20%20%20%20%20%20%20%20SAVE%20%20%20%20%20%20%20%20%22%20OnClick%28%29%3D%22self.parent.opener.SaveDoc%28%29%3B%22%3E%20%3CINPUT%20TYPE%3DBUTTON%20NAME%3Dcancel%20VALUE%3D%22BACK%20TO%20BUILDER%22%20OnClick%28%29%3D%22self.parent.close%28%29%3B%22%3E%3C%2FFORM%3E%0A%0A%3C%2Fbody%3E%3C%2Fhtml%3E%0A"><br></FORM>
</BODY></HTML>
0
garikCommented:
To make it work, I'd to do two things:
1) put document.writes to onLoad handler and pass it the value of the hidden field
2) remove META tag from this value
While the first step doesn't affect logic too much, second might be crucial for your application. Right now I've no idea why META causes reloading.
Working code is below.

<HTML><HEAD>
<SCRIPT language=javascript>
function fill(doc) {
      pwin=window.open('','P');
      pwin.document.write('<FRAMESET COLS="100%" ROWS="59,*" noborder border="0">');
      pwin.document.write('<FRAME NAME="menu" SRC="about:blank" SCROLLING="NO" MARGINHEIGHT=0 MARGINWIDTH=0>');      
      pwin.document.write('<FRAME NAME="main" SRC="about:blank" SCROLLING="AUTO" MARGINHEIGHT=0 MARGINWIDTH=0>');
      pwin.document.write('</FRAMESET>');
      pwin.menu.document.close();
      pwin.menu.document.open();
      pwin.menu.document.write(unescape(doc));
        pwin.menu.document.close();
}
</script>
</HEAD>
<BODY onLoad='fill(document.preview_html.menu_preview.value);'>
<FORM name=preview_html>
<INPUT TYPE=HIDDEN NAME=menu_preview value="%3Chtml%3E%3Chead%3E%0A%3Ctitle%3EIDAs%2FUSAs%20Proxy%20Menu%20Preview%3C%2Ftitle%3E%0A%3Cbody%20bgcolor%3D%22%23333399%22%20background%3D%22..%2F..%2Fmenus%2Fmenu_images%2Fm_id_bkgrnd.gif%22%20leftmargin%3D0%20topmargin%3D0%3E%0A%3Cp%3E%0A%3CCENTER%3E%3CFORM%3E%3CINPUT%20TYPE%3DBUTTON%20NAME%3Doksave%20VALUE%3D%22%20%20%20%20%20%20%20%20SAVE%20%20%20%20%20%20%20%20%22%20OnClick%28%29%3D%22self.parent.opener.SaveDoc%28%29%3B%22%3E%20%3CINPUT%20TYPE%3DBUTTON%20NAME%3Dcancel%20VALUE%3D%22BACK%20TO%20BUILDER%22%20OnClick%28%29%3D%22self.parent.close%28%29%3B%22%3E%3C%2FFORM%3E%0A%0A%3C%2Fbody%3E%3C%2Fhtml%3E%0A"><br></FORM>
</BODY></HTML>

0
askrinskyAuthor Commented:
Thanks Garik! For a moment, I've abandoned javascript here for perl.  I'll tell you what happens when I try again with javascript using your recommendations.  AK.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.