error script Jsauth

Topics: ASP.NET 2.0, Business Logic Layer, Controls, Themes
Nov 16, 2012 at 8:04 PM
Edited Nov 16, 2012 at 8:04 PM

Hi

when i open a post i have this error script

SCRIPT438: Object does not support this property or method 'cookie'

jsauth, line 1179 Carattere 5

function SetCookies(id, note) {
    $.cookie('quck-note-current', JSON.stringify({ "Id": id, "Note": note }), { expires: 7 });
} 

what can to be???

i don't know what script (jsauth is not in Scripts)

HELPPPPPPPP

Coordinator
Nov 16, 2012 at 8:26 PM

"jsauth" is a script bundle for logged in (authenticated) users. You probably missing 02-jquery.cookie.js in the /Scripts folder.

var jsauth = new Bundle("~/Scripts/jsauth");
jsauth.AddDirectory("~/Scripts", "*.js", false); 
jsauth.AddFile("~/admin/widget.js");
jsauth.AddFile("~/Modules/QuickNotes/Qnotes.js");   
BundleTable.Bundles.Add(jsauth);
Nov 16, 2012 at 9:24 PM

No rtur i have the Script 02-jquery.cookie.js in folder Scripts

is this..

jQuery.cookie = function (name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

i read this post

http://stackoverflow.com/questions/5237460/cookie-is-not-a-function-error-in-ff-eventhough-i-include-it

but i use only jquery-1.7.2.min.js for theme AllTuts

Coordinator
Nov 16, 2012 at 10:15 PM

Turn optimization off in settings and check what scripts get loaded and if you have any JS errors. May be you have two jquery scripts, one loaded by BE and one by your theme - that would trigger all kind of conflicts. May be script that uses cookie loaded before jquery.cookie.js.

Nov 19, 2012 at 11:53 AM
Edited Nov 19, 2012 at 3:17 PM

ok i have made a control...

the problem is in Qnotes.js

SCRIPT438: Object does not support this property or method 'cookie'
Qnotes.js, Riga 219 Carattere 5

function SetCookies(id, note) {
    $.cookie('quck-note-current', JSON.stringify({ "Id": id, "Note": note }), { expires: 7 });
}

How to solve?
Coordinator
Nov 19, 2012 at 3:30 PM

You need to find why $.cookie can't be called. It is a function from jquery.cookie.js - does it loaded before qnotes.js? If you have cookie.js loaded and then qnotes.js loaded, you should not see this error. It basically says that function in qnotes.js calls function cookie() in cookie.js and can't find it.

Nov 19, 2012 at 3:36 PM

Ok rtur, i see this error only when i open a Post , and then qnotes don't work

in Home i see (in IE 9) perfectly qNote

Nov 19, 2012 at 4:35 PM

i have founded the error, is caused by another jquery, but now i see quick note only in IE9 and i don't see nothing in Chrome and Firefox

very strange!

Coordinator
Nov 19, 2012 at 5:18 PM

You might need to clear cache on those browsers. Hit Ctrl+F5 couple times or go to browsers "clear cache" option, for example under "tools -> clear recent history" in the FireFox.

Nov 20, 2012 at 2:51 PM

nothing rtur... in chrome and firefox quick note don't work... i have clean cache and made ctrl+f5 and clean history... nothing

in IE9 work.... and in home i don't have nobody error JS...

others suggestions?