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 = window.location.host; /*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 = window.location.search; </script>
To use <a> tag as navigation link:
<a href="AddEmployee.aspx" onclick="location.href=this.href+QueryString;return false;">Add Employee</a>