SharePoint Provider Hosted APP How to create Navigation Link using HTML href Attribute

By using  HTML <a> href attribute we can set navigation link or href with SharePoint Provider Hosted APP.

To use <a> href Attribute tag as Navigation Link use below code.

We can extract QueryString and append it with new page’s url. Script to get Query String and other URL Related Information is as below:

 <script type="text/javascript">
 /*Get Server Name and Port Website Port Number e.g. http://localhost:1193*/
 var ServerandPort =;
 /*Get Actual Page URL. e.g./ViewEmployees.aspx */
 var PageURL = window.location.pathname;
 /*Get Url's Query string e.g. ?SPHostUrl=http%3A%2F%2Fsqlserver%3A3333 ......*/
 var QueryString =;

To use <a> tag as navigation link:

 <a href="AddEmployee.aspx" onclick="location.href=this.href+QueryString;return false;">Add Employee</a>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s