OfficeDev / script-lab-2017

[Archived. This is an older version that's no longer maintained. See https://github.com/officedev/script-lab instead]
https://aka.ms/scriptlab
MIT License
218 stars 60 forks source link

Ribbon buttons: add "open in window" and/or push on platform to allow launching windows on all platforms #402

Open Zlatkovsky opened 7 years ago

Zlatkovsky commented 7 years ago

From Mourad Louha's excellent blog post (auto-translated to English): http://www.excel-ticker.de/prototyping-von-microsoft-office-javascript-add-ins-mit-script-lab/

image

Zlatkovsky commented 7 years ago

@saunders77 , what I mean is having a navigation bar at the top, with a link. Something like this:

You can use clipboard.js to do the clipboard-copying part.

image

saunders77 commented 7 years ago

Got it, thanks!

hongbo-miao commented 7 years ago

Personally I think just using default browser may provide better experience

image

Zlatkovsky commented 7 years ago

Yep, 100% agree. The problem is that doing a window.open wasn't working on at least some of the platforms (Office Online, IIRC).

I suppose one possible solution is for us to use OfficeHelpers to check the host type, and use the dialog API for Office Online and window.open for the others. @saunders77 , do you remember if we tried that combo? it feels like it should work, but I'm also surprised we wouldn't have thought of it before...

Thanks!

WrathOfZombies commented 7 years ago

What's wrong with just having a link whose domain isn't in the AppDomain list. Secondly OfficeHelpers doesn't seem the place for this. It will unnecessarily bloat things up overtime.

WrathOfZombies commented 7 years ago

To that effect the second part of the title, to push on platform makes the most sense to me.

Zlatkovsky commented 7 years ago

@WrathOfZombies , I don't mean add new code to OfficeHelpers. I just mean using platform detection (OfficeHelpers.Utilities.host).

I agree that pushing on the platform is also good on this, it's just that we need a stopgap measure.

@saunders77 , if the issue with window.open is indeed only on Office Online, I wonder if the correct (and simple) solution is simply to have Office.js overwrite (monkey-patch) window.open to show a UI with a user-clicked <a href="" /> action that would allow the click through past the popup blocker (much as the dialog API does today if you set the non-iframe option...). Is this a bug you can file and push on the platform on?...

Thanks!

Zlatkovsky commented 7 years ago

@saunders77 , ping