search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Open link in new window

Asked by Steve Lee
11 months ago.

Hi :-)

In my scheduler I've added in a new menu item from the right click menu:

{text: "Job Card", onClick: args => location.href = args.source.data.Filelocation},

It works, opening a job card for the scheduled item. However, I need it to open in a new browser tab, or in a popup window. I've tried a million and one combinations of window.open but cannot get this to work. Can you help?

Thank you.

Answer posted by Dan Letecky [DayPilot]
11 months ago.

The `window.open()` function is the correct approach:

{text: "Job Card", onClick: args => window.open(args.source.data.Filelocation, '_blank')},

But if the browser is set to block popup windows it will not open.

See also:
https://stackoverflow.com/questions/4907843/open-a-url-in-a-new-tab-and-not-a-new-window

Comment posted by Dan Letecky [DayPilot]
11 months ago.

Another option would be to use DayPilot.Modal which wouldn't open it in a new tab/window but in a modal dialog in the same page. It can display a special page (in an iframe) using showUrl() method:

https://api.daypilot.org/daypilot-modal-showurl/

Comment posted by Steve Lee
11 months ago.

Ah! Thank you :-)

I was almost there I had that almost correct accept I had window.open args =

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.