Close HTML page with close button, no confirmation dialogue

I have a webpage (page A) that has a link on it to open another webpage (page b) using _blank as target. I want to add a close button on page b. I tried this javascript code:
<form method="post">
<input type="button" value="Close Window"
onclick="window.close()">
</form>
It works, but it displays the dialogue box "Are you sure you want to close this window"?. I want to have the close button but I DON'T want it to bring up this YES/NO question, I just want it to close the window. Is this possible?
thx experts...BobR
bobrossi56Asked:
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.

Dave BaldwinFixer of ProblemsCommented:
<input type="button" value="Close Window" onclick="window.close()">

Firefox says: "Warning: Scripts may not close windows that were not opened by script."  In Chrome and Safari it does nothing.  In Opera it does close the window.
0
bobrossi56Author Commented:
I am missing your point Dave.

Most people I know are using IE8, so is it possible to put a close button that doesn't ask you any questions no matter the browser?
0
chaitu chaituCommented:
its browser dependant browser message.you cannot avoid this message.
if you see the gmail also if you close the window it will give you same message.
if you dont want message try creating child window using CSS .
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

chaitu chaituCommented:
"Are you sure you want to close this window"?.

above message will come in IE when user close window

in FF you will get another message.
in chrome i dont think you will not get any message.

but as you said most users will use IE so you cant avoid that message.

so instead of opening browser window try to create child window using css and put close button at the top(X);
0
bobrossi56Author Commented:
The child window sounds like the way to go, problem is I have never done that and have no idea HOW to do it. CSS has never been my forte. Any pointers would be appreciated.
thx
0
chaitu chaituCommented:
or you can try jquery dialog
0
Dave BaldwinFixer of ProblemsCommented:
Most people I know use anything but IE.  My point was that it is blocked in those other browsers.
0
bobrossi56Author Commented:
The jquery seems to be what I am looking for, but I have never used it before. I put the code in my HTML page, but when I click the link to that page it still brings up a completely new page with the dialogue box inside the page, so now you still have to close the page. Is there a way to just bring up the jquery dialogue box without bringing up another html page. All I am trying to do is bring up a pop-up message...I was using overlib code to do this but I ran into a problem with it and cannot get any support. In a perfect world when someone clicked (or moused over) a word on my webpage, a small dialogue box would pop up with a message. Since I couldn't get overlib to work the way I wanted, I figured I would just do it with a new HTML page, but wanted to put a close button on it. Now that I see jquery, I would rather just "pop" that type of dialogue box up and let them click the X in the upper right corner.
thx folks...
0
chaitu chaituCommented:
so you are using jquery dialog box.
0
bobrossi56Author Commented:
Ya, I took the code from the jquery page and pasted it in my HTML page, I like the look/feel of the box but don't want it inside another web page. Can it just pop up and not be embedded in a webpage?
0
chaitu chaituCommented:
if you jquery dialog box you will see X in the upper right corner.if user wants he can click that and close the window.
0
bobrossi56Author Commented:
I am not getting the impression chaituu that you understand my question. Your answer does not address my question at all. I want the jquery dialogue box to "POP UP" and not be inside another webpage. Don't know how to do that, or if it is even possible.
0
chaitu chaituCommented:
if you use jquery dialog that dialog box inside with another webpage only.if you use window.open then its is two separate windows(one parent,other one child);

what is you problem if you open dialog box inside web page.
0
bobrossi56Author Commented:
Bringing up another webpage is too messy just to show site visitor a quick message.
0
chaitu chaituCommented:
0
bobrossi56Author Commented:
OK, everybody made this WAY more complex and confusing than it had to be. I found my answer on another forum. All I had to do to accomplish what I wanted was to add this ONE line of code to my parent HTML page:

<a href="javascript:alert('Place your Text Here' + '\n' + 'Place your Text Here')">Click Here</a>

thanks anyway
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
chaitu chaituCommented:
you should have told me before that just putting alert message;we should have post yesterday itself.;

you should have spefically told us to put some alert message.we thought you want some kind of child widnow to display some text boxes etc..

any way you solved your problem.next problem be specific to your problem.
0
bobrossi56Author Commented:
True, I wasn't as clear as I should have been in my initial post, but I did VERY specifically state what I was tryiing to do in my 12/21/11 06:53 AM, ID: 37319824 post, specifically stating:

"[ All I am trying to do is bring up a pop-up message ]"

Perhaps that wasn't understood.
0
bobrossi56Author Commented:
I accepted my own solution as it was exactly what I needed. I figured it out myself.
0
chaitu chaituCommented:
yes may be.it should have stated pop up error message or alert message.any way leave it .
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.