JavaScript's window.open not working with IE 8

nkrulez
nkrulez used Ask the Experts™
on
Hi, i have a PHP script which generates links like this
javascript:location='index.php'; window.open('view.php?id=2', 'View Page', 'height=250, width=250, scrollbars=yes');
but the links don't open using IE8 .. with a "Error On Page" note on status bar. though they work fine with other browsers like FF or Google Chrome.. is this a code issue or a browser one?

Thank you.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Try window.location instead of "location"

Commented:
Then try to put "window.location=...;" after the window.open(...);

Commented:
Try:

javascript:location.href='index.php'; window.open('view.php?id=2', 'View Page', 'height=250, width=250, scrollbars=yes');

Open in new window

Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Commented:

<javascript type="text/javascript">
function RunLink(link1, link2, windowOptions)
{
    location.href=link1;
    window.open(link2, 'View Page', windowOptions);
}
 
//then generate links like
<a href="javascript: RunLink('index.php', 'view.php?id=2', 'height=250, width=250, scrollbars=yes');">click here </a>

Open in new window

Author

Commented:
Thanks but none of the above worked..

this is the exact code
echo "<td align=\"center\"><a href=\"javascript:location='index.php'; window.open('view.php?id=$Row[ID]', 'View Page', 'height=250, width=250, scrollbars=yes');\"><img alt=\"View\" src=\"images/vimg.gif\"></a></td>\n";

Open in new window

Commented:
Remove the space form the window name, I forgot to tell you that.
Commented:
This should work, or using my method.
echo "<td align=\"center\"><a href=\"javascript:location='index.php'; window.open('view.php?id=$Row[ID]', 'View_Page', 'height=250, width=250, scrollbars=yes');\"><img alt=\"View\" src=\"images/vimg.gif\"></a></td>\n";

Open in new window

Commented:
This is simpler in call:
<javascript type="text/javascript">
function RunLink(link1, link2, windowOptions)
{
    location.href=link1;
    window.open(link2, 'View_Page', windowOptions);
}
 
//then generate links like
<a href="javascript: RunLink('index.php', 'view.php?id=2', 'height=250, width=250, scrollbars=yes');">click here </a>

Open in new window

Commented:
In IE, window name is an identifier, that's why it must not contain a space.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial