Opening new window issues with IE

Hello world!

I have problems with simple function called by onclick. Function is in JS and looks like this:

[code]

[/code]

In body, I call it by onclick atribute. Everything works perfect with Chrome and FF but bloody IE simply ignores it. Tried almost everything but…

Anyone has any suggestions?

Is IE’s built-in POP-UP-STOPPER turned on? Check that first.

Also, I found that in some versions you have to supply a handle to the pop-up window and set the focus to it if it does not switch automatically. Here is some code I found on this issue…
(Note that the variable is defined OUTSIDE the function so it is a GLOBAL variable and not gone after the function ends and is useable in the new window…) Doesn’t need to be a function…

var newwindow;
function popwindow(url)
{
	newwindow=window.open(url,'name','height=400,width=200');
	if (window.focus) {newwindow.focus()}
}

good luck…

@ErnieAlex

Thanks for helping me out again. The thing is, I hadn’t used IE for years 'cause my opinion on it can’t be expressed without swear words (I probably have aversion to it…). I simply assumed that when everything is displayed correctly in Chrome, Safari and FF, it would work for IE as well.

It seems that all IE setting should be OK. The example you posted did not change the behavior of IE and I don’t want to invest hours into research on how to make thing which should be working work in bloody IE.

I’m currently working on function which will sort this out differently…

To anyone who’ll experience similar issue in future:

In the end, I decided that having form as a pop-up is not worth so much effort for IE users (I realise it’s more than half of users but for now, I’m OK when the form opens and users of standards compliant browsers will benefit of better layout :slight_smile: )

Here’s the summary:

  1. I needed the form to be accessible for everyone
  2. I wanted it to be small pop-up (it has only few lines, namely Name, Email, Message, Submit, so it wouldn’t look well in full-size browser window)

Function I used is:

<script type="text/javascript"> function mailto_form() { window.open( "mailto_form.html", "myWindow", "status = 1, height = 335, width = 300, resizable = 0" ) } </script>

Here is the event I used to call the function:

<a href="#" onClick="(mailto_form())">Contact Us</a>

Everything worked fine if you use anything else than IE (not sure about ‘anything’ but tested in Chrome, FF, Opera and Safari). IE wouldn’t call function mailto_form(), just the href="#".

After hours trying to figure out, what’s wrong, I decided to try different approach. Keep everything same and modify just if the user is IE users. Initially I tried to define the link calling the mailto_form() function as:

<a href="mailto_form.html" onClick="(mailto_form()); return false">Contact Us</a>

I called the link directly and result - every browser opened it in same window… I had to change the approach:

I defined variable $mailto_popup this way:

[php]<?php
$browser = $_SERVER[‘HTTP_USER_AGENT’];
if(preg_match(’/MSIE/i’,$browser))
{
$mailto_popup = “mailto_form.html”;
}
else{
$mailto_popup = “#”;
}
?>
[/php]

so for IE users it will contain link, for others just #.

Then I used $mailto_popup variable in the link calling function mailto_form() this way:

[php]Contact Us[/php]

The result is:

If the visitor uses IE, link will open mailto_form.html in same browser window (far too huge for small form but whatever - important is that it works :slight_smile: ). If the visitor doesn’t use IE, the same form will be opened as a small (and much better looking) pop-up.

I realise this is not best solution but it works everywhere. I plan to add variable to the link and display the page with some sort of warning for IE users.

Hope this might help someone else in future

BTW, I’m leaving this issue not solved as this is just provisional solution.

Slightly off-topic, I found a long time ago a very very nice JQuery Contact Form pop-up routine.
It is free and looks awsome! I have altered the form to be a log-in form and an error-message form.
Also, is uses CSS so, you can match your colors and whatever. Thought you might like to take a peek
at it. Reusable, customizable, etc… Nice! It does take a bit of prodding to understand it and alter it.
But, the result are great! (Hmmm, sounds like I sell’n something… LOL!)

Oh, and why I’m pointing it out is that it also seems to work well with IE… Just FYI…

http://www.html-form-guide.com/contact-form/simple-modal-popup-contact-form.html

I actually tried to make primitive version of something like this today. Not finished yet, though. Take a look at your for inspiration. Thanks

Sponsor our Newsletter | Privacy Policy | Terms of Service