Solved

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

Posted on 2004-09-13
8
1,298 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSS Scroll Issue 3 81
JavaScript export function not working in IE 15 31
Why does my button disappear? 3 26
form button worked now it doesnt anymore 9 37
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

919 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

13 Experts available now in Live!

Get 1:1 Help Now