Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

FRAME SRC="about:blank" oddities

Posted on 1997-05-20
4
Medium Priority
?
340 Views
Last Modified: 2008-03-17
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
0
Comment
Question by:askrinsky
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
garik earned 200 total points
ID: 1265650
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
 

Author Comment

by:askrinsky
ID: 1265651
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
 
LVL 3

Expert Comment

by:garik
ID: 1265652
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
 

Author Comment

by:askrinsky
ID: 1265653
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question