Friday, December 5, 2014

How to redirect a page in SharePoint with JavaScript

There are many ways to redirect a page in SharePoint - embedding code in the page itself, or using some tools that need to be installed on the web front-ends. The code might not be an option for everyone (you need Visual Studio) and the tools have their additional administration overhead.

If you don't have any URL rewrite modules like Helicon or the free one from Microsoft or you simply don't want to use such tools, here's an easy script that will help you redirect users from a SharePoint page to any location.

Just add that in a Content Editor Web part and that should be all working.

<script type="text/javascript">
window.location = "http://<the desired URL here>"
</script>

Hope you find that helpful.

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or learn thru JavaScript Online Training India. Nowadays JavaScript has tons of job opportunities on various vertical industry. JavaScript Training in Chennai

    ReplyDelete