Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Dynamic url in promoted links

$
0
0

Hi,

We want to create a template having promoted links included as a part of the template. Hence whenever a site is created using this template will have promoted links to it.

There are 2 promoted links that we create which points to 2 libraries in the same site viz., List A and List B. We are using jquery currently to achieve this and following is the code:

<script type="text/javascript" src="https://code.jquery.com/jquery-1.10.2.min.js"></script><script language="javascript">
	$(document).ready(function () {
});

	$(function()
	{
		var webAbsURL = _spPageContextInfo.webAbsoluteUrl;
		var linkTitle = "";
		var url = "";

		$("a[id^=Tile_WPQ]").each(function()
		{
			$(this).click(function ()
			{
				linkTitle = $(this).find('li[title]').attr('id');

				switch (linkTitle)
				{
					case 'Tile_WPQ3_1_6':
						STSNavigate(webAbsURL + "/Lists/ListA/Allitems.aspx?Source=" + webAbsURL + "/default.aspx");
						break;

					case 'Tile_WPQ3_2_6':
						STSNavigate(webAbsURL + "/Lists/ListB/Allitems.aspx?Source=" + webAbsURL + "/default.aspx");
						break;

					default:
						STSNavigate(webAbsURL);
				}
			})
		})
	});
</script>

The above code is added in the home page using script editor web part. The site is a sub-site and not the top level site.

While creating the promoted links, we have added "/" value in the link location as a temporary entry since the field is compulsory.

It works perfectly fine in IE. Rarely I see that Firefox redirects the page to the "/" site instead of the respective library but rest of the time it redirects to the correct library. However Safari browser always redirects the page to the "/" site and never ever worked so far.

Can someone please provide guidance on achieving the best solution possible so that it works fine on all the browsers.

Thank you and

Regards

Tanzim


Tanzim Akhtar


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>