Solved

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

Posted on 2004-09-13
8
1,263 Views
Last Modified: 2012-08-14
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
Comment
Question by:Kim Ryan
  • 5
  • 2
8 Comments
 
LVL 8

Expert Comment

by:_aaron_
ID: 12051018
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
 
LVL 8

Accepted Solution

by:
_aaron_ earned 250 total points
ID: 12051033
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
 
LVL 33

Expert Comment

by:knightEknight
ID: 12051132
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
 
LVL 8

Expert Comment

by:_aaron_
ID: 12051140
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 19

Author Comment

by:Kim Ryan
ID: 12051257
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
 
LVL 8

Expert Comment

by:_aaron_
ID: 12051263
If the above methods dont work, I cant see any other way around...
0
 
LVL 19

Author Comment

by:Kim Ryan
ID: 12051279
the opener.close() works OK, but the alert window can get obscured so may confuse the user. thanks for your help.
0
 
LVL 8

Expert Comment

by:_aaron_
ID: 12051282
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

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now