cross browser compatible Popup window with simple javascript

Hi - I'm trying to get a simple extra browser window to open when I click a  button.  It's a demo of how a Help file will open in another window when the user clicks the "?" button.

I found the script attached and was happy with all the options it provided but I'm getting really sketchy results.

IE6 "blinks" when the new window opens. The window calling the function kind of goes blank for a second.

Firefox wants to download the new content or open it with IE.

Is this a simple thing to remedy?

Thanks in advance for your experience.

d2
function openHelpWin()
{
window.open("_help/HelpFile.mht","_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=480, height=270");
}
 
<!-- and then I call it with this -->
<input type="image"  src="_images/square_Help_btn_off.jpg"  alt="HELP" onclick="openHelpWin()" />

Open in new window

dzash2000Asked:
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.

dzash2000Author Commented:
Hi -
Here's more information.  

I found out what was happening when IE6 blinks out as I described before.  The source page (the page with the Help button calling the function) is reloading!  

This make the whole situation even worse.  I need to keep the source page from reloading.  That's imperative!

I hope I explained this well enough.

TIA
d2
0
BadotzCommented:
Not sure about that IE6 reloading - I'll fire up the laptop tomorrow and try your example.

Meanwhile: I have found the spaces in the features list are a Very Bad Thing. Sometimes they will be applied, sometimes not, so I always remove spaces. Thus this:

"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=480, height=270"

becomes this:

"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=480,height=270"
0
bugadaCommented:
The image input acts like a submit button (but the coordinates of the image that were activated are sent back to the server in addition to the rest of the form data).

So when you click on the image the onclick event is fired and a new window opened then the page reloads because the form has been submitted.

To prevent submission add a "return false;" just after your function call (see snippet below) in the onclick event.

Firefox doesn't support by default MHT files, so the default behavior is asking you to save it, or open it with the default associated application (normally IE). You can solve this problem locally by installing one of the several plugins available to enable MHT support.



<input type="image"  src="_images/square_Help_btn_off.jpg"  alt="HELP" onclick="openHelpWin(); return false;">

Open in new window

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
dzash2000Author Commented:
bugada - thanks.  "return false" was the magic word(s) that did the trick. It works great now.
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
Web Languages and Standards

From novice to tech pro — start learning today.