locked
How to set Links to “Open in new tab” by default? RRS feed

  • Question

  • When inserting link, SharePoint identifies that it is a link and it opens a pop up to add text to display and web address. There is an option under LINK to check whether the links will open in a new tab or not. Is there any way (OOTB or may be through jQuery) where we can check this checkbox by default all the time? 

    enter image description here

    Friday, February 21, 2020 9:00 AM

All replies

  • Hi,

    There is no OOB solution to check “Open in new tab” by default.

    As a workaround, you can add the script below in a Script Editor on the page, which will force all the newly added links to open in new tabs:

    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    <script type="text/javascript">
    $(function(){
    	if($("a")!=null){
    		$("a").each(function (i) {
    			$(this).attr("target", "_blank");
    		});
    	}
    })
    </script>

    The “Open in new tab” checkbox will not be checked when you insert a new link on the page, but the link will be modified to open in a new tab. The checkbox will be checked later when you edit the link.

    Best regards,

    Chelsea Wu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, February 24, 2020 9:47 AM
  • Hi,

    Please remember to update this thread if you have any progress.

    Thank you for your understanding.

    Best regards,

    Chelsea Wu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, February 27, 2020 8:57 AM