Solved

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

Posted on 2004-09-13
8
1,472 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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
 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses

623 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