Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 599
  • Last Modified:

Using Java I need to remove the address bar

I have script that Sizes, removes toolbar, location, menubar, and scrollbars I need to remove the address bar as will. Can anyone help on this.
I have tried addressbar=0 and address=0 bothe with no effect.

John
<script LANGUAGE="JavaScript">
 
 
function LaunchNewWindo(url, bChromeless, bResize)
{
	var nWidth = screen.availWidth;
	var nHeight = screen.availHeight;
 
	// Get the width
	if (nWidth > 820)
	{
		nWidth = 980;
		nHeight = 640;
	}
 
	// Build the options string
	var strOptions = "width=" + nWidth +",height=" + nHeight;
	strOptions += ",resizable=yes"
	strOptions += ", status=1, toolbar=0, location=0, menubar=0, scrollbars=0";
 
	// Launch the URL
	window.open(url+"page.cfm" , "_blank", strOptions);
 
}
 
</script>

Open in new window

0
john_hollings
Asked:
john_hollings
  • 25
  • 17
  • 12
  • +1
6 Solutions
 
silemoneCommented:
0
 
BadotzCommented:
Add:

location=no,

to your options string, and that should do it.
0
 
BadotzCommented:
And be consistent: either use OPTION=0/1 or OPTION=yes/no.

And do *not* put spaces between the options - odd things happen if you do.
var strOptions = "width=" + nWidth +",height=" + nHeight,resizable=yes,status=yes,toolbar=no,location=no,menubar=no,scrollbars=no";
 
// or
 
var strOptions = "width:" + nWidth +",height:" + nHeight,resizable:yes,status:yes,toolbar:no,location:no,menubar:no,scrollbars:no";

Open in new window

0
Technology Partners: 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!

 
BadotzCommented:
Sorry, bad strings:
var strOptions = "width=" + nWidth +",height=" + nHeight + ",resizable=yes,status=yes,toolbar=no,location=no,menubar=no,scrollbars=no";
 
// or
 
var strOptions = "width:" + nWidth +",height:" + nHeight + ",resizable:yes,status:yes,toolbar:no,location:no,menubar:no,scrollbars:no";

Open in new window

0
 
john_hollingsAuthor Commented:
Thanks I have tried both with no affect, the item I need to remove is shown in the image

John
window.jpg
0
 
BadotzCommented:
The code below opens a new window *without* the address bar, proving that what you want is indeed possible:


window.open("http://www.javascript-coder.com","mywindow","menubar=1,resizable=1,width=350,height=250");

Open in new window

0
 
BadotzCommented:
A little research on your part wil reveal the various features available when opening a new window.

The very first Google result (out of about 206,000) for [javascript:window.open] has working examples:

http://www.javascript-coder.com/window-popup/javascript-window-open.phtml

I believe I have said all along that it is the "location=0" feature you need to use.
0
 
BadotzCommented:
And it isn't "Java", it is "javascript".

Comment edited by WhackAMod 11.24.08
0
 
silemoneCommented:
wow...Badotz, you're really on fire about this situation...lol...
0
 
silemoneCommented:
well obviously if you solution works you should get the points...take it up with arbitrator for the room...and they can force you to get points...it may be a case where someone is paying for their points and are low, so they get solution, act as if nothing worked and then try to reuse points...may be he didn't implement your solution well, but you're right that your solution does work...
0
 
silemoneCommented:
i also gave a link to an accepted solution on experts-exchange that answered this question and he bypassed my solution...so who knows...my answer is verified...it was a solution for the same question...go figure...but hey, points come and go...good luck...
0
 
john_hollingsAuthor Commented:
I have been away and not responded as quick you may like.

I am sorry it I used the term Java instead of JAVESCRIPT.

I have put your answers in place with no and 0. I still have the address bar showing.
View http://localhost/documents/e-learning.cfm click Demo the address bar is displayed.
<script LANGUAGE="JavaScript">
function LaunchPresentation(url, bChromeless, bResize)
{
      var nWidth = screen.availWidth;
      var nHeight = screen.availHeight;

      // Get the width
      if (nWidth > 820)
      {
            nWidth = 980;
            nHeight = 640;
      }

      // Build the options string
      var strOptions = "width=" + nWidth +",height=" + nHeight;
      strOptions += ",resizable=yes"
      strOptions += ", status=1, toolbar=0, location=0, menubar=0, scrollbars=0";

      // Launch the URL
      window.open(url+"quizmaker.html" , "_blank", strOptions);

}
</script>

Link to action the javascript

<a href="#" onClick="javascript:void(LaunchPresentation('../e-preview/ncplh/',false, false))"><img src="/siteimages/binoc.jpg" alt="Demo Course" width="30" height="22" border="0" align="absbottom"><br /><span class="bottomnavlink">Demo</span></a

I don't think I will renew my membership next year...
off-topic comments removed.

Open in new window

0
 
BadotzCommented:
Perhaps if you do not reference the "location=0" in your features list, there will be no address bar?

Also, you have SPACES in your featurs list - something I pointed out long ago as being troublesome.

And you still mix "=yes" with =0", something I pointed out long ago.

Look, if you don't want to take my suggestions seriously, then don't. But if you do not even try them, then please don't complain that what I suggested "doesn't work".
Off topic comments removed

Open in new window

0
 
silemoneCommented:
Badotz has a point...
0
 
john_hollingsAuthor Commented:
My final say
I have tried all the suggestions given and in all options the location bar for the URL is not removed.
I am not an expert, as all of you guys are that is why I signed up to this forum. May be it my explorer I am using Microsoft IE7.
What ever the reason; I should not be criticised for not knowing or assigning points when I already said that I had tried the suggestions given.
I thought that the point of Expert Exchange to pass on your knowledge to us less knowledgeable mortals. If this cant be done in a friendly and helpful way why are you there?
0
 
silemoneCommented:
as far as myself, I'm not looking for points...usually experts don't express their displeasure except with a slight criticism...so I think Badotz feels strongly that his way works...we all know that you can remove an address bar as even the link i sent which is from experts exchange has a solution, but the confusion is why aren't these time tested solutions working for you?  anyway, good luck with your developing...

cheers
0
 
BadotzCommented:
>>I have tried all the suggestions given and in all options the location bar for the URL is not removed.

Post all of your non-working code for us to examine, please. No links, no files to download, just the non-working code.

Give us something to go on, eh?
Off-topic comments removed.

Open in new window

0
 
john_hollingsAuthor Commented:
Ok, this is the code that sets the new window size and options, below that is the hyperlink to call this code.

This is live at http://www.dhtraining.com/documents/e-learning.cfm to view the window click Demo

Thanks
<!--- Script To Open window -->
<script language="JavaScript" type="text/JavaScript">
<!-- Hide script from old browsers
function systemWindow(tilejpg) {
tileWindow = window.open(tilejpg, "tileWin", "width=690,height=675")
tileWindow.focus()
}
//-->
</script>
<script language="JavaScript" type="text/JavaScript">
<!-- Hide script from old browsers
function locationsWindow(tilejpg) {
tileWindow = window.open(tilejpg, "tileWin", "width=80,height=475")
tileWindow.focus()
}
//-->
</script> 
<script LANGUAGE="JavaScript">
function LaunchPresentation(url, bChromeless, bResize)
{
	var nWidth = screen.availWidth;
	var nHeight = screen.availHeight;
 
	// Get the width
	if (nWidth > 820)
	{
		nWidth = 980;
		nHeight = 640;
	}
 
	// Build the options string
	var strOptions = "width=" + nWidth +",height=" + nHeight;
	strOptions += ",resizable=0";
	strOptions += ", status=0, toolbar=0, location=0, menubar=0, scrollbars=0";
 
	// Launch the URL
	window.open(url+"player.cfm" , "_blank", strOptions);
 
}
 
</script>
<!--- End Script -->
 
<!--- Hyper link to action script --->
<a href="#" onClick="javascript:void(LaunchPresentation('../e-preview/ncplh/',false, false))"><img src="/siteimages/binoc.jpg" alt="Demo Course" width="30" height="22" border="0" align="absbottom"><br /><span class="bottomnavlink">Demo</span></a>
<!--- End Hyper link to action script --->

Open in new window

0
 
BadotzCommented:
Comment lines 33 and 34 - if you do not need a feature, then don't reference it at all.
33: //        strOptions += ",resizable=0";
34: //        strOptions += ", status=0, toolbar=0, location=0, menubar=0, scrollbars=0";

Open in new window

0
 
BadotzCommented:
And once again, you include SPACES in your features list. This is the third time I pointed this out to you.
0
 
john_hollingsAuthor Commented:
Spaces (shown as * here)
status=0,*toolbar=0,*location=0,*menubar=0,*scrollbars=0";
have been removed still no joy
33: //        strOptions += ",resizable=0";
34: //        strOptions += ", status=0,toolbar=0,location=0,menubar=0,scrollbars=0";

Open in new window

0
 
BadotzCommented:
Did you comment the lines?
0
 
john_hollingsAuthor Commented:
No, I have this.
strOptions += ",resizable=0";
strOptions += ",status=0,toolbar=0,location=0,menubar=0,scrollbars=0";
0
 
BadotzCommented:
Please read and implement http:#a23015571
0
 
john_hollingsAuthor Commented:
I have Comment // both lines, I have tried deleting them and run both versions.

//  strOptions += ",resizable=0";
//  strOptions += ",status=0,toolbar=0,location=0,menubar=0,scrollbars=0";
0
 
silemoneCommented:
try clearing your cache...maybe its loading from cached code
0
 
silemoneCommented:
doesn't happen a lot, but i've run into that problem before in IE
0
 
BadotzCommented:
So let's see your exact >window.open< statement, and anything it references.
0
 
john_hollingsAuthor Commented:
<script LANGUAGE="JavaScript">
// The following code is integrated to open the presentation in a new window.
// To launch the presentation immediately, when a link is clicked, call LaunchPresentation when the onClick event is triggered.
//
// LaunchPresentation(url, bChromeless, bResize)
//
// Parameters:
// bChromeless - Opens a new window without the toolbar, addressbar, statusbar, menubar, and scrollbars
//
// bResize - Determines whether or not the new window can be resized
//
/******************************************************************************/

function LaunchPresentation(url, bChromeless, bResize)
{var nWidth = screen.availWidth;
var nHeight = screen.availHeight;
if (nWidth > 820)
{
nWidth = 980;
nHeight = 640;
}

// Build the options string
var strOptions = "width=" + nWidth +",height=" + nHeight;
//  strOptions += ",resizable=0";
//  strOptions += ",status=0,toolbar=0,location=0,menubar=0,scrollbars=0";

// Launch the URL
window.open(url+"player.cfm","_blank",strOptions);
}
</script>

// The link
<a href="#" onClick="javascript:void(LaunchPresentation('../e-preview/ncplh/',false, false))"><img src="/siteimages/binoc.jpg" alt="Demo Course" width="30" height="22" border="0" align="absbottom"><br /><span class="bottomnavlink">Demo</span></a>
0
 
BadotzCommented:
I mentioned a link to examples in http:#a23013289.

Visit that site and try the examples. When you find one that works, view the page source and copy it into your page, making any necessary changes.
0
 
silemoneCommented:
did you solve?
0
 
john_hollingsAuthor Commented:
No, I have changed the code so many times, used all comments and links given, but yet the location bar is stil displayed.  I was informed that it may well br IE 7 and this can not be removed in the current version. I will keep on researching the issue and if and when I get a result I post it back.

Thanks for your input, I sign it off to Badotz: as it was most input on this

John
0
 
silemoneCommented:
most definite about signin it to Badotz...you and he worked your butts off trying to fix...good luck...
0
 
BadotzCommented:
sheesh - if I didn't provide a solution, then say so. There is no need to award points if no solution was provided.

I will ask a Moderator to reopen the question so you can delete it.

But first...

Please tell us how the examples worked from this link:

http://www.javascript-coder.com/window-popup/javascript-window-open.phtml

When I try Example 1, it opens a window with a link that says, "Open the JavaScript Window Example 1 ". When I click this link, a new window opens AND THERE IS NO ADDRESS BAR. I used IE7 for this test.

Please tell us how the SAME TEST does not work for you?


0
 
john_hollingsAuthor Commented:
SAME TEST "Open the JavaScript Window Example 1 ".
When I click this link, a new window opens as shown below. I have highlighted in red the part I am triying to remove as you can see it still there.
new-window.jpg
0
 
BadotzCommented:
Now we're getting somewhere.

What about Example #2 ?

0
 
BadotzCommented:
How odd...

In IE7, Example #1 opens a window with no address bar. Example #2 has an address bar. Looking at the window.open statement, #1 does not mention "location" and #2 does. This is expected behavior.

In Firefox 3.0.4, example #1 opens a window WITH AN ADDRESS BAR, but example #2 does not!

Who doesn't believe that confusion reigns supreme!
0
 
john_hollingsAuthor Commented:
Example #2
new-window-ex2.jpg
0
 
BadotzCommented:
Here is how I see it. Four of the five major browsers work as expected:

IE 7.0.5730.13
Example #1 - No address bar
Example #2 - Address bar present

Safari 3.2 (525.26.13) - as expected
Example #1 - No address bar
Example #2 - Address bar present

Google Chrome 0.3.154.9
Example #1 - No address bar
Example #2 - Address bar present

Opera 9.6.2 Build 10467)
Example #1 - No address bar
Example #2 - Address bar present

The odd man out is:

Firefox 3.0.4
Example #1 - Address bar present
Example #2 - No address bar
0
 
BadotzCommented:
OK - let's investigate just how the features can be specified.

"location=1" means "give me an address bar" to everyone except Firefox.

So, let's try using an alternate syntax:

// Build the options string
var strOptions = "width=" + nWidth +",height=" + nHeight;
strOptions += ",resizable=no";
strOptions += ",status=no,toolbar=no,location=no,menubar=no,scrollbars=no";

// Launch the URL
window.open(url+"player.cfm","_blank",strOptions);
0
 
john_hollingsAuthor Commented:
It just don't figure, What ever I do it always open WITH AN ADDRESS BAR. I am lost for words now I tried all the options you gave BEFORE I posted the request ya, I know there was a few typos but the function worked (with an address bar).

I am using IE 7.0.5730.13 however I also have Coldfusion server installed, just maybe there is some sort on conflict.

I am now using your last script
0
 
john_hollingsAuthor Commented:
Sorry no change :-(
0
 
BadotzCommented:
Wow. I don't know what to say.

You're saying you always get an address bar, no matter what?

Do you have a different browser to try this in?

I'm running Winxp Pro SP3, fully patched. How about you?
0
 
john_hollingsAuthor Commented:
I know how you feel, I have spent hours on this, if I use another browser it my well work but my web stats show 94% of clients use IE which is why I am using it.

OS Name      Microsoft Windows XP Professional
Version      5.1.2600 Service Pack 3 Build 2600
I think it is one of the wonders of coding, If I can ever fix it I'll post it but I'm not very hopeful.
0
 
BadotzCommented:
>>94% of clients use IE

Of your clients, or the world. If the latter, thos stats seem a tad on the high side to me...

Anyways, here is a test page that works for me:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>JavaScript Window Open Example</title>
</head>
<body>
<SCRIPT language="JavaScript1.2">
var win_1 = null;
var win_2 = null;
//
function openwindow_1() {
	if (win_1 != null) { win_1.close(); }
	//
	win_1 = window.open("http://www.javascript-coder.com","mywin1","menubar=yes,resizable=yes,width=350,height=250");
}
//
function openwindow_2() {
	if (win_2 != null) { win_2.close(); }
	//
	win_2 = window.open("http://www.javascript-coder.com", "mywin2","location=yes,status=yes,scrollbars=yes,width=100,height=100");
}
function cya() {
	if (win_1 != null) { win_1.close(); }
	if (win_2 != null) { win_2.close(); }
}
window.onunload = cya;
</SCRIPT>
<P>
<A href="javascript: openwindow_1()">Window Open: No address bar</A>
</P>
<P>
<A href="javascript: openwindow_2()">Window Open: With address bar</A>
</P>
</body>
</html>

Open in new window

0
 
john_hollingsAuthor Commented:
Thanks again for you input and help on this issue.

Your code does show the two windows and intended, I think it has been working all the time in a manner, the code removes the FUNCTION of the address bar, it still displays the URL. The url can not be changed, edited or removed and the dropdown shows a blank list.

It seems to me like the resizable if set to '0' or 'no' it still shows but is locked out.

May be I just can not remove completely, but at least it locked. Should we put this to bed now and close the question?

Stats show UK clients not the world that has visited my site.
Hits in the last 7 days 35,005: IE user 29,903 = 85%
0
 
BadotzCommented:
>>I think it has been working all the time in a manner, the code removes the FUNCTION of the address bar, it still displays the URL.

No way should this just be deleted. Either I provided a solution - as I stated previously, and >john_hollings< agrees - or there is more to discover here.
0
 
silemoneCommented:
I agree...Badotz has worked hard on this...
0
 
BadotzCommented:
The browser discrepancy alone makes this thread worth saving, even if it is not worth any points for any Experts.
0
 
john_hollingsAuthor Commented:
I awarded the points once and closed the question. Badotx re-opened it and cancled the points.

Let all get on with what we here for. Wishing a great holiday time to all.
Edited.

Open in new window

0
 
silemoneCommented:
Wow, some really made experts look really bad...the problem is remember though we answer questions, we also ask them...how would we like dealing with pompousness, arrogance, short-tempered, or frustrated experts...if you don't like the way points are awarded, get an Administrator to mediate a solution...even make a comment, but don't let it get to the point where this thread did...just my take on things...

cheers and good luck to all...
0
 
BadotzCommented:
>>Why did you object to the close with points awarded?

Because at the time, the solution had not been determined. Or, more accurately, the problem had not been revealed.

I still do not know if the Asker's address bar is an issue, since he never clearly stated if anything herein removed the address bar from his new window. I believe it did, but cannot say for sure.

The fact that Firefox does not "play nice" with the [window.open] is interesting, but again, I'm not sure if this is the problem or not.

It would be nice if the Asker would speak up through all of the din and clamor and state, once and for all, if he can opena new window without an address bar being present,, but it doesn't look like that is going to happen.
0
 
john_hollingsAuthor Commented:
I have changed the code so many times, used your comments and links, but will continue to use the code I have been using I will be working on this issue part time to correct it. As you gave the most input I am accepting you answers.
John
0
 
BadotzCommented:
"Wade through the muck"? What muck?

As far as I'm concerned, you have no business speaking for the Asker. If the Asker has not instructed you to close the post, who are you to decide?

I want to know if the problems is solved. I don't care about the points, I want to know if the problem is solved.

Don't you? Isn't that the point?
0
 
dnbCommented:
I have the same issue with Google Chrome ... regardless of whether location=0|no is specified, or entirely omitted, when opening a pop-up, the pop-up ALWAYS displays the address/location bar.  The only difference as far as I can see is that if location=no then the address bar is not editable.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 25
  • 17
  • 12
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now