Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
zapisivanje cookiesa s javasciptom - safari problem

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Client-side
View previous topic :: View next topic  
Author Message
zvone



Joined: 09 Sep 2003
Posts: 160
Location: Zg

PostPosted: 01.11.2007 23:17    Post subject: zapisivanje cookiesa s javasciptom - safari problem Add user to your forum ignore list Reply with quote

Pozdrav

Imam 3 funkcije u javascriptu koje mi služe za rad s cookiesima. Jedna je za zapisivanje cookiea, druga za brisanje i treća za čitanje.

U svim browserima radi OK (IE, FF, Opera) osim u Safariju. Testiram na windowsima Safari 3.0 beta.

Ovo su moje funkcije
Code:

function createCookie(name,value,days) {
   if (days) {
      var date = new Date();
      date.setTime(date.getTime()+(days*24*60*60*1000));
      var expires = "; expires="+date.toGMTString();
   }
   else var expires = "";
   document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
   var nameEQ = name + "=";
   var ca = document.cookie.split(';');
   for(var i=0;i < ca.length;i++) {
      var c = ca[i];
      while (c.charAt(0)==' ') c = c.substring(1,c.length);
      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
   }
   return null;
}

function eraseCookie(name) {
   createCookie(name,"",-1);
}


Ima netko ideju zašto ne želi zapisati cookie u safariju s ovom funkcijom ? Cookie ne zapisuje 100% jer sam ga probao pročitati odmah nakon zapisivanja i izbaci mi null - odnosno ništa.

Puno hvala

_________________
Odin's descendant
Back to top
View user's profile Send private message
zytzagoo
mi3.crew


Joined: 25 Aug 2003
Posts: 1842
Location: Zagreb, Hrvatska

PostPosted: 02.11.2007 17:10    Post subject: Add user to your forum ignore list Reply with quote

Odi tu: http://www.quirksmode.org/js/cookies.html

ima test dio, pa vidi jel radi u Safariju setanje i slicno. Ako radi, eto ti tamo 3 funkcije koje
ce raditi onda svuda.

_________________
[+]I[+]am[+]my[+]own[+]religion[+]
Back to top
View user's profile Send private message Visit poster's website Twitter profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Client-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group