Mono Support What is the correct way to include jQuery-ui.css from a cdn in Monox? 

Viewed 36596 time(s), 6 post(s), 5/7/2012 1:43:41 PM - by Jeremy
5/7/2012 1:43:41 PM
322 Reputation 36 Total posts

Is there a setting in Monox for jQuery UI cascading style sheets (css) to be delivered by a content delivery network (cdn) like the javascript files?

I am looking for a setting that will add this:


These are the settings for the javascript in the web.config:

1
5/7/2012 3:41:16 PM
7207 Reputation 956 Total posts

There is no such config setting - however, if you call PageUtility.InjectJQuery method, it registers the jQuery UI js file by taking it from the web.config. The same method also tries to register the CSS with the same name from the same location (it replaces .min.js with .css), so there is no need for a separate setting.
If you need to do it manually, you can call a method HtmlFormatter.CreateCssLink and pass it the URL of your CSS file.

2
5/8/2012 8:57:43 AM
322 Reputation 36 Total posts

Unfortunately the automatic setting results in an incorrect link being added to my pages:

<link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.19/jquery-ui.css" rel="stylesheet" type="text/css" />

IE9 developer tools give a misleading error message "This stylesheet cannot be viewed because its source is in a different domain than the page." The file does not exist. Google gives a 404 error.

So I will have a look at the manual setting. Is there any way to stop the automatic css link from being added?

3
5/8/2012 12:27:16 PM
7207 Reputation 956 Total posts

By default, it is being applied only for admin users in the Main.master page. You cannot avoid it in this version, but you can manually register your own CSS URL.

4
5/8/2012 9:45:16 PM
322 Reputation 36 Total posts

Thank you for the clarification. I had been doing all my testing as admin. I can live with the incorrect link under those circumstances for the benefits of using a cdn. I have been able to successfully manually add the css using the method you described:

using MonoSoftware.Web;
 
    protected void Page_Load(object sender, EventArgs e)
    {
    }


Thank you.

5
5/8/2012 11:17:11 PM
15993 Reputation 2214 Total posts

Hi,

we have logged in your suggestion / issue as a feature request so we will decide if this will be implemented in the next release.

Regards

6
This is a demo site for MonoX. Please visit Mono Software for more info.