Forum Discussion
william41550
Aug 15, 2023Copper Contributor
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 f...
william41550
Aug 22, 2023Copper 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.
Seems like hyperlinks always opens a new tab, still the link is in the tenant.
ganeshsanap
Aug 22, 2023MVP
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.
- william41550Aug 23, 2023Copper ContributorIt does not work, still opens a new tab when i click on hyperlinks in a ppt , the links are in the same tenant. if i do a quicklink it opens in the same tab , but not hyperlinks in a dokument.
Any suggestions?- ganeshsanapAug 23, 2023MVP
william41550 That is a default behavior in SharePoint to open the hyperlinks inside the document/PPT content in new tabs.
Unfortunately, you cannot override this behavior even with the modern script editor and HTML/CSS/JS.
Above code and modern script editor will only work for the anchor tags (<a>) / hyperlinks which are directly available in the DOM structure of a SharePoint page - like for links in quick links web part, site navigation links, links in text web part, etc.
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.