• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 27021
  • Last Modified:

Hide title bar or URL in Javascript window.open

I wrote some pages in asp for a client.  Their partner is going to link to a page on this site (that also links to one other page).  We need to hide the URL so it is not apparent to a web user that the url has changed.  I don't think it matters if the user wants to poke around and actually sees the URL but we don't want to make it obvious.

I've reviewed many posts on EE and found some great solutions but none of them are actually hiding the the title bar.  Here's the solution I liked the best and tried to implement.

<script language="JavaScript">
<!--
 function openWindowNew( windowURL, windowName) {    windowFeatures='width=518,height=500,toolbar=0,location=0,screenx=0,screeny=0,directories=0,status=0,menuBar=0,scrollBars=yes,left=0,top=0,resizable=0'
          return window.open( windowURL, windowName, windowFeatures ) ;
     }
//--->
</script>
On the partner's webpage:
  <a href="JavaScript: newWindow = openWindowNew('http://www.myclientURL.com/mypage.asp', 'Mywindowname'); newWindow.focus()">My Link Text </a>

The link works but I still see the URL of my client's site because the title bar is not hidden.  For example, let's say my client's stie is www.myclientURL.com and the page we want to bring up is mypage.asp.  From the partner's site, when I put the code I described above, the page opens great but in the title bar, I see "http://www.myclientURL.com" then what's between <title></title> on the page we're linking to.  However, when I open that page directly (http://www.myclientURL.com/mypage.asp in address bar) from IE, I only see what's between the title tags.  I have tried setting fullscreen=yes and still the same result.  Obviously, I've faked the URLs for this example but what I've described is exactly what's happening.  I see "http://www.myclientURL.com   MY PAGE TITLE   Microsoft Internet Explorer" using the Window.open but see only "MY PAGE TITLE  Microsoft Internet Explorer" when I go directly to the page.  Any ideas?
Thanks,
Alexis
0
alexisbr
Asked:
alexisbr
1 Solution
 
TyrannusCommented:
0
 
alexisbrAuthor Commented:
Tyrannrus,
Can you please tell me what I should change?  I looked at the link and I had already set location=no as well as most of the other options.  Is there another setting I missed?
Thanks,
Alexis
0
 
Michel PlungjanIT ExpertCommented:
<script language="JavaScript">
<!--
function openWindowNew( windowURL, windowName) {      
  var windowFeatures='width=518,height=500,toolbar=0,location=0,scrollBars'
  return window.open( windowURL, windowName, windowFeatures ) ;
}
//--->
</script>
On the partner's webpage:
  <a href="#"
onClick="newWindow = openWindowNew('http://www.myclientURL.com/mypage.asp', 'Mywindowname'); newWindow.focus(); return false">My Link Text </a>

should be enough.

If not, then the browser is set to not allow this.

Then instead open a frameset with the new page embedded

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Michel PlungjanIT ExpertCommented:
Like this:

<script language="JavaScript">
<!--
function openWindowNew( windowURL, windowName) {      
  var windowFeatures='width=518,height=500,toolbar=0,location=0,scrollBars'
  return window.open( windowURL, windowName, windowFeatures ) ;
}
//--->
</script>
On the partner's webpage:
  <a href="#"
onClick="newWindow = openWindowNew('frameset.html?'+escape('http://www.myclientURL.com/mypage.asp'), 'Mywindowname'); newWindow.focus(); return false">My Link Text </a>


and in frameset.html have

<frameset onLoad="top.content.location=location.search.substring(1)" rows="100%,*">
<frame name="content" src="about:blank">
</frameset>
0
 
alexisbrAuthor Commented:
Thanks, mplungian.  The first way didn't work so I guess I can't use the window.open.  I tried to implement the second way with a basic test on my websit using yahoo.com to open up in the frame.  The window opens but I don't see yahoo.

Here's the test page, testframe.html:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Test page</title>
<script language="JavaScript">
<!--
function openWindowNew( windowURL, windowName) {      
  var windowFeatures='width=518,height=500,toolbar=0,location=0,scrollBars'
  return window.open( windowURL, windowName, windowFeatures ) ;
}
//--->
</script>
</head>
<body>
 <a href="#" onClick="newWindow = openWindowNew('frameset.html?'+escape('http://www.yahoo.com'), 'Mywindowname'); newWindow.focus(); return false">Here's the link to yahoo</a>
</body>
</html>

Here's the frame page, frameset.html:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>frame page</title>
</head>
<body>
<frameset onLoad="top.content.location=location.search.substring(1)" rows="100%">
<frame name="content" src="about:blank">
</frameset>
</body>
</html>

Did I miss something?  I also tried putting ";" after return false and that didn't change anything.  
Alexis
0
 
Michel PlungjanIT ExpertCommented:
remove body tags in the frameset page!!!
0
 
alexisbrAuthor Commented:
I removed the body tags and now I get a message "Page not found".  If I change the link to a page on my website, it works but the point of this is to be able to point to a different URL and have the current URL stay in the title bar.  Did I do the url correctly next to escape?
Thanks,
Alexis
0
 
GawaiCommented:
to cant hide title . why dont you use layer instead ?

<script>
function ShowDiv(DivName)
      {
            if      (document.layers) {
                  document.layers[DivName].visibility="visible";
            } else if (document.getElementById) {
                  document.getElementById(DivName).style.display="";
                  document.getElementById(DivName).style.visibility="visible";
            } else if (document.all) {
                  document.all(DivName).style.display="";
                  document.all(DivName).style.visibility="visible";
            }
      }

      function HideDiv(DivName)
      {
            if      (document.layers) {
                  document.layers[DivName].visibility="hidden";
            } else if (document.getElementById) {
                  document.getElementById(DivName).style.display="none";
                  document.getElementById(DivName).style.visibility="hidden";
            } else if (document.all) {
                  document.all(DivName).style.display="none";
                  document.all(DivName).style.visibility="hidden";
            }
      }
</script>

      <DIV id="popup" style="Z-INDEX: 999; LEFT: 40%; VISIBILITY: hidden; WIDTH: 239px; POSITION: absolute; TOP: 300px; BACKGROUND-COLOR: #3f3f3f">

        <div id="CloseWindow" align="right" style="height:77px; font-size:10px;">
          <div style="padding-top:5px; padding-right:8px;"><a href="javascript:HideDiv('popup');" style="color:#ffffff;">X Close</a></div>

        </div>
    <!-- here you can insert client url in using ifram -- >
      </DIV>

<a href="javascript:ShowDiv('popup');" class="White" title="popup">Show Popup</a>
0
 
Michel PlungjanIT ExpertCommented:
Ahh, sorry...

"top.content.location=unescape(location.search.substring(1));"

0
 
alexisbrAuthor Commented:
mplungian,
Thank you.  That worked.  I applied the logic to my more complicated client pages and it also worked.  I appreciate your help.
Alexis
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now