1

Given that we have the below hyperlink in the word add in HTML page (e.g. Home.html):

<a href="www.google.com" target="_blank">Go to google</a>

Clicking on "Go to google" opens www.google.com using Internet Explorer outside the Word add-in.

The problem is the default browser is set to Google Chrome and we wish to open all the external links using the default browser set by the user.

How can we achieve this?

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
  • Welcome to Stack Overflow! Since you are new user, I recommend you read ["How to Ask a Good Question"](https://stackoverflow.com/help/how-to-ask). Asking question properly will help you get better answers and help others be able to understand your question if they have a similar problem. – Marc LaFleur Oct 24 '17 at 23:01
  • Thanks for your prompt response @MarcLaFleur-Microsoft , can you give it another try as I rephrased the question (it is about the default browser) – Sebastian Allen Oct 26 '17 at 06:25
  • Possible duplicate of [Open an html page in a default browser from an add-in](https://stackoverflow.com/questions/38044279/open-an-html-page-in-a-default-browser-from-an-add-in) – Marc LaFleur Oct 26 '17 at 06:38

2 Answers2

2

As Marc points out, it’s not possible today. That being said, there is an API being developed that will do just that. I can’t comment on the timing yet, but it is “soon”. I recommend you ping this thread in a few weeks, and there may be more info to share.

  • We are indeed having conversations about an API to open the default browser. Don't have an ETA to share yet. – Humberto Lezama Oct 26 '17 at 19:27
  • Sounds promising, would it work on Office 2013 or only for Office 2016 and above? – Sebastian Allen Oct 30 '17 at 10:37
  • Would it be possible to run an .exe from the add-in ? In this case we would call FF or Chrome.. I know it is not a clean solution but a temporary workaround. – Sebastian Allen Oct 30 '17 at 10:45
  • When it does come, it would be to Office 2016 (in fact, more specifically, Office 365, the subscription evergreen version). So unfortunately, there isn't anything we can do for 2013. – Michael Zlatkovsky - Microsoft Oct 31 '17 at 02:50
  • As for running an exe -- no, that's definitively not possible. Think of an add-in like a regular Internet Explorer browser window (which effectively is what it is on Desktop; and the local equivalent on iOS). So in terms of opening a browser/link, whatever you can do from a website, you can do from an add-in; but you can't do more than that. It looks like there are some tricks (e.g., https://www.adamfowlerit.com/2015/05/how-to-launch-a-url-in-google-chrome/), but it requires you to have initial control of the machine's registry (might you might be able to set via Group Policy in enterprise) – Michael Zlatkovsky - Microsoft Oct 31 '17 at 02:53
  • Thanks @MichaelZlatkovsky-Microsoft – Sebastian Allen Oct 31 '17 at 10:15
  • @MichaelZlatkovsky-Microsoft It's almost 2020 now. Any updates on this? Also is it possible to other browser's instance like chrome's instance while opening addin instead of IE 11? – aaryan Dec 29 '19 at 11:23
  • @aaryan, I wish I could help, but I'm no longer involved in the day-to-day running of those particular decisions (and moreover, I'm on paternity leave at the moment). I recommend that you either re-ask the question as a new question (so that it shows up on the team's radar), and/or add/upvote a suggestion on https://officespdev.uservoice.com/. – Michael Zlatkovsky - Microsoft Dec 31 '19 at 02:51
1

It isn't possible to define which browser opens a link. When you open a new window using target="_blank" you are simply asking the current browser to open that destination in a new window within the same browser application.

Since Office for Windows hosts add-ins in an embedded IE 11 instance, this will always be Internet Explorer.

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63