Customizing the "viewer.aspx" Page Redirect in SharePoint Online

Copper Contributor

Hello everyone,

 

I am currently working on a project where I need to customize the behavior of the "viewer.aspx" page in SharePoint Online. Specifically, I want to intercept the call to the "viewer.aspx" page and redirect the user to a different page.

 

Here's the scenario: When I use "Bing search for work" and search for a document, the search results point to the document using the "viewer.aspx" handler in the following format:

 

`https://<tenant>.sharepoint.com/sites/<Site>/_layouts/15/viewer.aspx?sourcedoc={29g142de-1564f-47b7-af87-e7e51af931b3}`

My requirement is to intercept this call landing on the "viewer.aspx" page and redirect the user to a different page. I am looking for a way to achieve this either programmatically or through configuration.

 

I have done extensive research on this topic, but I haven't found a solution that specifically addresses this requirement. Most resources discuss general redirection in SharePoint Online, but none seem to cover the customization of the "viewer.aspx" page.

 

Can anyone provide guidance on how to achieve this? Any help or direction would be greatly appreciated.

 

Thank you in advance for your assistance.

Best regards,

Hasan

1 Reply

Hi,

One option I see here is to develop a custom SPFx extension that can model the redirection you need