To improve performance on our web site, we only add RADTooltip instances to our control hierarchy (ASP.NET) when a user is logged in. We do have RADEditor instances but these have "Enabled" set to false.
This works great - no Telerik script files are downloaded until we need them.
Unfortunately, when a postback occurs, a "scriptStartupBlock" is being emitted and causing a JavaScript error, since none of the Telerik client libraries have been downloaded. Here is the script:
if (!$telerik.isSafari)
{
var links = document.body.getElementsByTagName('link');
if (links && links.length>0)
{
var documentHead = document.getElementsByTagName('head')[0];
if (documentHead)
{
for (var i=links.length-1;i>=0;i--)
{
var linkTag = links[i];
if (linkTag.title == 'Telerik stylesheet')
{
if ($telerik.isIE)
{
linkTag = linkTag.cloneNode(true);
}
documentHead.appendChild(linkTag);
}
}
}
}
}
This works great - no Telerik script files are downloaded until we need them.
Unfortunately, when a postback occurs, a "scriptStartupBlock" is being emitted and causing a JavaScript error, since none of the Telerik client libraries have been downloaded. Here is the script:
if (!$telerik.isSafari)
{
var links = document.body.getElementsByTagName('link');
if (links && links.length>0)
{
var documentHead = document.getElementsByTagName('head')[0];
if (documentHead)
{
for (var i=links.length-1;i>=0;i--)
{
var linkTag = links[i];
if (linkTag.title == 'Telerik stylesheet')
{
if ($telerik.isIE)
{
linkTag = linkTag.cloneNode(true);
}
documentHead.appendChild(linkTag);
}
}
}
}
}