Hey guys,
I'm working on a task that I consider a kind of challenge. So, that's the deal.
I need to programmatically determine which clientlib to use. for example, if a website has already the AngularJS then I would call a specific clientlib with a non-AngularJS dependency and vice-versa,
This could be used on a website where AngularJS is already used, and it could be used on a website where AngularJS is not being used (and needed as a dependency).
If you guys could help me with this, I really would appreciate it.
Thanks for sharing.
Have a good one!!!
Solved! Go to Solution.
It is not recommended to create conditional logic or wrapper to decide which Script/CSS/Client lib to be used. As this introduce delays in the process and might be technically not supported.
Whereas we can certainly do this by creating conditionally lading of JS:
var head = document.getElementsByTagName('head')[0];
var js = document.createElement("script");
js.type = "text/javascript";
if (condetion 1)
{
js.src = "js/jquery_computer.js";
}
else
{
js.src = "js/mobile_version.js";
}
head.appendChild(js);
Related Reference post:- Using common template for differnt project having different css
~kautuk
It is not recommended to create conditional logic or wrapper to decide which Script/CSS/Client lib to be used. As this introduce delays in the process and might be technically not supported.
Whereas we can certainly do this by creating conditionally lading of JS:
var head = document.getElementsByTagName('head')[0];
var js = document.createElement("script");
js.type = "text/javascript";
if (condetion 1)
{
js.src = "js/jquery_computer.js";
}
else
{
js.src = "js/mobile_version.js";
}
head.appendChild(js);
Related Reference post:- Using common template for differnt project having different css
~kautuk
Kautuk is 100% correct
Views
Replies
Total Likes
Views
Like
Replies