Link to home
Start Free TrialLog in
Avatar of Kim Ryan
Kim RyanFlag for Australia

asked on

href link to open a browser from an outlook HTML email using javascript

I need to include a web site link in an email I am sending to users of MS Outlook 2000.
The email is sent in HTML format and it all displays correctly. Here is the code I use:

<a href="javascript:window.open('http://www.mysite.com','my_title','toolbar=no,
location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,
width=500,height=400')">My Link</a>

This works fine and opens the  browser with no scrollbars, buttons etc as I have specified. The problem is that a second full sized browser appears behind the first. In the browsers  and in the brwoser itself,it just says:  [object]

I have tried links in the follwing formats but they don't start a browser at all
<a href="window.open(...
<a href onclick="window.open(...

Is there a way to suppress this second browser from appearing?
Avatar of _aaron_
_aaron_

Simple solution, dont open it in a new window, it is not necessary - the email client will know to open a browser already:

<a href="http://www.mysite.com','my_title','toolbar=no,
location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,
width=500,height=400'">My Link</a>
ASKER CERTIFIED SOLUTION
Avatar of _aaron_
_aaron_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of knightEknight
also consider using the onclick handler ... by returning false you can possibly eliminate that pesky second browser:

<a href="http://www.mysite.com"  target="my_title"
   onclick="window.open( this.href, this.target, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,
width=500,height=400');return false;">My Link</a>
Mmmm.... Interesting idea, how about ignoring the original function of the element, and simply ignore href:


<a onclick="window.open( 'http://www.mysite.com', this.target, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,
width=500,height=400')">My Link</a>
Avatar of Kim Ryan

ASKER

thanks _aaron_ and knightEknight. I tired both suggestions, but they both launch full size browsers with scrollbars and buttons. Also, from outlook preview pane, the email displays a script icon, which may cuase some people to think they have a virus attached to the email.

I can live with the second browser window being manully closed, if there is no other work around.
If the above methods dont work, I cant see any other way around...
the opener.close() works OK, but the alert window can get obscured so may confuse the user. thanks for your help.
np ;-) Happy to help!

PS: Maybe try opener.focus();opener.close(), it *should* give the parent focus before closing (thus alert will appear in front of screen )