Forum Discussion

william41550's avatar
william41550
Copper Contributor
Aug 15, 2023

stop Hyperlink in sharepoint online open new tab

Hello!

I have a picture with hyperlinks in sharpont online, but i want to stay in the same tab when klicking.

It opens a new tab, and it will be som many tabs thats confusing, is there i solution for this to stay in the same tab?

 

 

 

  • SharePoint will automatically open in a new tab if the URL to the item isn't using your tenant's SharePoint URL. I had the opposite issue, where I wanted to open links in a new tab rather than the current tab. I used some Javascript and the Modern Script Editor to make that work.

    https://steveknutson.blog/2023/05/20/sharepoint-quick-links-open-in-new-tab/

    You could do the opposite with a small modification to the code I used. Change the a.target="_blank"; to a.target="" and change the startsWith URL.

    I hope that helps.
    • william41550's avatar
      william41550
      Copper Contributor
      I installed modern scriprt app and changed the code but i did not work for me. Hyperlinks in dokument still opens in new tabs. I am no expert at java, but i paste the exatly code.
      Seems like hyperlinks always opens a new tab, still the link is in the tenant.

      • ganeshsanap's avatar
        ganeshsanap
        MVP

        william41550 Try _self instead of _target: 

         

        a.target="_self";

         


        Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

Resources