I am usiing the Optimus Package for bundling and minification.
To increase website performace I want to load bundles after page load to increase performace, as stated here :https://varvy.com/pagespeed/defer-loading-javascript.html
Now, I was going to use this function, without using even the jquery
<script type="text/javascript">
function downloadJSAtOnload() {
var element = document.createElement("script");
element.src = "defer.js";
document.body.appendChild(element);
}
if (window.addEventListener)
window.addEventListener("load", downloadJSAtOnload, false);
else if (window.attachEvent)
window.attachEvent("onload", downloadJSAtOnload);
else window.onload = downloadJSAtOnload;
</script>
But I want the link to bundle and I don't know how to get only the link.
Any ideas please or else how to tackle this, in order load JavaScript, through bundling, after page loads?
Optimus Bundling Package - Load after page Load
Hi Guys,
I am usiing the Optimus Package for bundling and minification.
To increase website performace I want to load bundles after page load to increase performace, as stated here :https://varvy.com/pagespeed/defer-loading-javascript.html
Now, I was going to use this function, without using even the jquery
But I want the link to bundle and I don't know how to get only the link.
Any ideas please or else how to tackle this, in order load JavaScript, through bundling, after page loads?
Thank you
Hi Simon,
I guess you have this code in your template somewhere.
So you can modify it like this :
Dave
Currently, I am using
@Scripts.Render("~/bundles/global")
Hi Dave,
I have tried it in that way but it does not works.
@Scripts.Render will not render the script src only but including the scripts tags etc.
All I want is the actual link to src, which results eventaully to /bundles/hj4h234hh2h4h2424h2h4
Thanks
hi Simon,
I believe you can do :
This should only output the URL
Dave
is working on a reply...