问题
I have a DotNetNuke (DNN 9.0) website, and I see CSS/JQuery files are referenced as entrees in a *map.XML file, such as below:
<item key="7d14598udfghjho0348dfdgvt4644" file="" compression="" version="180">
<files>
<file name="/Resources/libraries/jQuery/01_09_01/jquery.js" />
<file name="/Resources/libraries/jQuery-UI/01_11_03/jquery-ui.js" />
</files>
</item>
I want to have more control on these references, such as being able to reference cloud(CDN) links instead, for example JQuery provides CDN below:
<script
src="https://code.jquery.com/ui/1.11.3/jquery-ui.min.js"
integrity="sha256-xI/qyl9vpwWFOsdaf/9WkG5j/SVasdf1viy8fWwbeE="
crossorigin="anonymous">
</script>
My problem is I cannot locate anywhere other than map.XML file that is referencing these files, and this XML file doesnot seem to be the right place for CDN references or any modifications because DNN regenerates this file and overrides manual additions.
Your ideas will be appreciated.
回答1:
It is a bit hidden since DNN 9. Go to Settings >> Extensions, select JavaScript Libraries from the dropdown list, click the pencil next to the JavaScript jQuery library, select the Extension Settings tab and enter the Url in the Custom CDN setting.
As the Bootstrap library is not included, you have to create it - thanks to Brian Dukes, a lot of popular libraries are already packaged as a DNN install file, so you can go to https://github.com/EngageSoftware/DNN-JavaScript-Libraries, download and install it. Then you can do the same as above.
If you don't find that it could be that the setting was not there in your DNN 9.0.x version - anyway, this is old and a lot of security issues have been fixed since then, so consider upgrade to a newer version (9.5.0 is current at the moment).
回答2:
I added CDN references in "Custom CDN" but after refreshing the page still local JQuery resources were loaded. I found this blog which is addressing same, and it seems admin needs to update the DNN database table directly in order to enable this.
SELECT s.SettingName, s.SettingValue
FROM [HostSettings] as s
WHERE SettingName = 'CDNEnabled' OR SettingName LIKE '%Custom%jQuery%'
来源:https://stackoverflow.com/questions/60516132/dnn-how-can-i-add-cdn-cloud-references-for-bootstrap-jquery-files