2

I am working on a plugin for Outlook Web Access. My plugin is simply a button using tag with target='_blank' which sends the user to another page. Based on the document from Microsoft:

In supported Web clients, such as Excel Online and Outlook Web App, Office Add-ins are hosted in an iframe that runs using the HTML5 sandbox attribute. ActiveX components or navigating the main page of the web client are not allowed. Office Add-ins support is enabled in the web clients by the integration of the JavaScript API for Office. In a similar way to the desktop client applications, the JavaScript API manages the add-in lifecycle and interoperability between the add-in and the web client. This interoperability is implemented by using a special cross-frame post message communication infrastructure. The same JavaScript library (Office.js) that is used on desktop clients is available to interact with the web client.

Because of the mentioned Sandbox, when the link is clicked, the target page is not shown properly and is shown partially. Surprisingly if I right-click on the same link and select "Open link in new tab", the target page is shown fine without missing its contents.

My question is: What is the difference between using the attribute target='_blank' in HTML and selecting the "Open link in new tab" option in the browser? And how I can simulate "Open link in new tab" option to make my plugin work without the user needing to right click on the link.

P.S. I have tried it in both Firefox and Chrome and they have the same behavior.

Community
  • 1
  • 1
Ali
  • 133
  • 4
  • 12

1 Answers1

2

target="_blank" generally will open the link in where ever the browser's configuration specifies it should. To my knowledge there is no way to control how this works in the markup itself. Have you tried this in multiple browsers? EDIT: to simulate the "open in new tab" functionality, target="_blank" is correct.

Paul Randall
  • 133
  • 10
  • I have used IE but the OWA interface is different and I don't see my plugin in it. I'll give it a try in Firefox – Ali Oct 21 '15 at 20:36
  • BTW, according to my experiment, "open in new tab" and `target="_blank"` are _not exactly_ the same – Ali Oct 21 '15 at 20:43
  • @Ali you're right, they aren't _exactly_ the same. However, to trigger the "open in new tab" functionality in your markup, `target="_blank"` is the standard attribute. There's more information on that [here](http://stackoverflow.com/questions/17711146/how-to-open-link-in-new-tab-on-html) – Paul Randall Oct 21 '15 at 21:05
  • There's also additional information [here](http://stackoverflow.com/questions/6296013/how-can-i-open-a-link-in-new-tab-and-not-new-window), with some JS scripts provided as examples you may be able to try. – Paul Randall Oct 21 '15 at 21:07
  • Thanks Paul, it seems that the CSS3 `target-new` is not supported in any of the browsers. And I have tried JS `window.open(url,'_blank')` which resulted in the same behavior as the `target='_blank'` – Ali Oct 21 '15 at 21:18
  • Hi @Ali. I know I'm super late in asking this, but would you mind accepting my answer as the answer to the question? – Paul Randall Jan 25 '16 at 16:14