Open Hyperlink in Dialog

I have a sharepoint list with a Hyperlink field, that links to a document associated with the list item. I have brought this list into a parent item using the list/library control in Forms. On the list view I have the Hyperlink field shown. I would like to open the Hyperlink in Dialog rather than a new window. Is this possible?

Dear @cwalter,
If the link leads outside of SharePoint, most likely not. Lookup links, for example, do open in dialog.

The Column is a Sharepoint Hyperlink column type. It links to a PDF in a sharepoint document library. Currently when it is clicked it opens a new tab. I would like to open in dialog.

Hello @cwalter2,

You can customize the view of columns in List or Library control and open PDF document in a dialog. Please find more information here.

Please find the code sample below. Replace Hyperlink with the column name.

fd.spRendered(function() {
    fd.control('SPDataTable1').templates = {
        Hyperlink: function(ctx) {
            var value = ctx.row.Hyperlink;
            if (!value) {
                return '';
                    return '<a target="_blank" data-interception="off" ' +
                        'onclick="window[\'' + ctx.openDialogFuncName + '\'](\'' + value + '\'); return false;" ' +
                        'href="' + value + '"> Dsplay Text</a>';

That worked perfectly. Thank you so much!

1 Like

Is there a way to specify the window height and width? I am running into an issue when opening on tablets, the window is too large and users are not able to close the dialog.

Hello @cwalter2,

Yes, you can specify the size of the dialog window using dialogOptions property of the List or Library control.

fd.control('SPDataTable0').dialogOptions = {
    width: 1280,
    height: 720

Please see more information here.

I have a similar Problem but i don't think this Solution is going to apply to my Problem.

I want to achieve the same result, but i have a different approach to it.

Differently than the request before. i don't have a form in which the Lookup Link is located.
The Lookup Link is directly in the SharePoint List before opening any form.

So when i click on this Link it should open a Dialog but instead it navigates to the Site the Link is from. It's a Cross-Site LookUp which is also one of your Products.

Is this maybe something that i can manage in the Manage LookUp Settings of the Cokumns?

Hello @Dario_Chiga,

What SharePoint version are you using?

If you are using SharePoint Online or 2019, you can try to change the column formatting to open a link in a dialog.

Please find more information in Microsoft documentation:

You can find the example of the JSON for SharePoint 2019 in the post here:

1 Like

This Works just to a certain extent. i can add the Json without Problems.
now the solution i want to have, is that when i click on this LookUp Value it should open the Item in a Dialog instead of opening a new Tab in the Browser.

So how can i find out which value i should insert into the "href" so that it open the link in a dialog?

I found it.
But it still does not open the Form in a Dialog.

Hello @Dario_Chiga,

It is not possible to change the look and the behavior of the column in the list view using the Cross-Site lookup settings.

You can try to change the column formatting to open the link in the dialog. You can contract MIcrosoft support or post your question to the Microsoft community for the instruction.

1 Like

Ah ok thanks :slight_smile:

then i will just leave it as it is. Not that big of a problem

1 Like