Articles about European Sharepoint Hosting Service
SharePoint 2013 Hosting – HostForLIFE :: SPFx Webpart Ignoring Target Attribute In Anchor Tag
Every modern page in SharePoint, by default, uses a page router(smart navigation) when a hyperlink is clicked to navigate. This behavior is intentional to avoid a complete refresh of the screen.
During development using SPFx( SharePoint Framework), smart navigation behavior might not be the expected one in all cases, as one of its consequences is using the target
attribute to open a page in a separate tab in the browser will be ignored.
Consider the following valid HTML markup, which will work outside SPFx:
Valid HTML
In the above case, the target
attribute will be ignored, and the page opens in the same tab via page router logic. To override the page router for hyperlinks, add the data-interception
attribute to the link with a value of off as shown below
.
HTML that would work in SPFx
When the link is clicked in the above example, the page will open in a new tab.
Have a nice day!!
Print article | This entry was posted by Peter on March 30, 2023 at 3:01 am, and is filed under European SharePoint 2013 Hosting. Follow any responses to this post through RSS 2.0. Both comments and pings are currently closed. |