• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1993
  • Last Modified:

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?
0
Kim Ryan
Asked:
Kim Ryan
  • 5
  • 2
1 Solution
 
_aaron_Commented:
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>
0
 
_aaron_Commented:
Though, this wont allow mods to the window properties ( oops )

This will close the parent, but will ask a question before its done...

<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');opener.close()">My Link</a>

As far as I am aware, you will have to continue using a popup ( thus require a parent window ) in order to mod the window properties... I think by using opener.close() is the only solution if you really must make mods to the window...
0
 
knightEknightCommented:
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>
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.

 
_aaron_Commented:
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>
0
 
Kim RyanIT ConsultantAuthor Commented:
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.
0
 
_aaron_Commented:
If the above methods dont work, I cant see any other way around...
0
 
Kim RyanIT ConsultantAuthor Commented:
the opener.close() works OK, but the alert window can get obscured so may confuse the user. thanks for your help.
0
 
_aaron_Commented:
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 )
0
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.

Join & Write a Comment

Featured Post

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.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now