0

Is it possible to do a page level url redirection like window.location.replace in sharepoint online modern site. I want to set this up for a specific library default url.

Thanks in advance

Regards

3
  • Can you describe the case further? What do you mean by "set this up for a specific library default url? What do you want to do? Jun 3 '20 at 5:03
  • Hi Mohamed, my requirement is that when a user navigates to a specific library, I want to redirect them to specific page.
    – Ropaesh
    Jun 3 '20 at 10:15
  • How do users go to the document library? Why can't you handle this at the location where users click the link? How do they go to the doc library in the first place? Jun 3 '20 at 13:31
0

Do you mean you want to add a page redirection in a modern page? To inserting Java script, you will need to use 3rd party tools like modern script editor. And if you want to set the redirection in a specific library, just switch to classic experience and add a script editor for a redirect like below

<script type="text/javascript">

 function redirect() {
   setTimeout("location.href='https://www.google.com'", 5000); 
 }

 _spBodyOnLoadFunctionNames.push("redirect");

</script>
1
  • Thank you Jerry. Is it possible to accomplish without switching to classic view of document library.
    – Ropaesh
    Jun 3 '20 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.