Re: How does one detect that Cookies are disabled?
Hi John, I just saw this and will check it out. I knew there are Javascripts to check for Cookies but was resisting going that route. I will give it a try. Thanks to you and Danny Beaubien. Cheers - Jim Labos - infobase -- Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
Jim, Dani Beaubien posted a link to a StachExchange thread that included the following javascript… if (navigator.cookieEnabled) {document.write("Cookies Enabled"); } else {documentwrite("Oops Cookies Not Enabled"); } I tried navigator.cookieEnabled in my test Xojo web app and it works perfectly. No reason it should not work anywhere you can execute javascript 4D or otherwise. Thanks to Dani, I hope this helps. John John Baughman 1331 Auwaiku Street Kailua, Hawaii 96734 (808) 262-0328 john...@hawaii.rr.com > On Jun 5, 2018, at 6:28 PM, Jim Labos - infobase via 4D_Tech > <4d_tech@lists.4d.com> wrote: > > Thanks to all that replied. I learned a lot here. It forced me to understand > the process and sequence of events that goes into creating, reading and > deleting Cookies. > > Cheers > > > > > > - > Jim Labos - infobase > -- > Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html > ** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: https://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ** ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
Hi John, found this on Stack Overflow. https://stackoverflow.com/questions/4603289/how-to-detect-that-javascript-and-or-cookies-are-disabled This might be what you are looking for. Dani Beaubien > On Jun 5, 2018, at 9:17 PM, JOHN BAUGHMAN via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > First of in my testing I am not involving 4D at all. I was simply using Xojo > to test what you said in your post. > > After a bit more testing, I realize now that I misunderstood your post > entirely. > > >> I don't know anything about Xojo, but from the code you posted all it seems >> to do is set a value on the server and immediately read it back. There is no >> way for the browser to have it yet. > > The code I quoted is Xojo code (not 4D) and it sets the cookie in the browser > from a Xojo web app. With Chrome’s developer’s console I can watch the cookie > being set when cookies are not being blocked. > > What I should have understood in your post was that any web app or web server > can only determine if a cookie is set by what is passed from the browser in > the http header. So if my Xojo web app sets a cookie in the browser, that > would not be reflected in the header until the header was updated, which > would only happen the next time an exchange occurred between the web app or > web server and the browser. Xojo is adding the cookies it set since receiving > the current header to my test. > > For my idea to work in Xojo or 4D Web Server, there would have to be a way to > refresh the http header without refreshing the whole browser window. Perhaps > not possible.??. I noticed that eventually the header is updated after the > user has invoked a request or 2 to 4D (4d Web Server only talks to the Xojo > web app not the browser). Not sure when or what causes the header update > during those exchanges. > > John > > > > > > > John Baughman > 1331 Auwaiku Street > Kailua, Hawaii 96734 > (808) 262-0328 > john...@hawaii.rr.com > ** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: https://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ** ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
Thanks to all that replied. I learned a lot here. It forced me to understand the process and sequence of events that goes into creating, reading and deleting Cookies. Cheers - Jim Labos - infobase -- Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
First of in my testing I am not involving 4D at all. I was simply using Xojo to test what you said in your post. After a bit more testing, I realize now that I misunderstood your post entirely. > I don't know anything about Xojo, but from the code you posted all it seems > to do is set a value on the server and immediately read it back. There is no > way for the browser to have it yet. The code I quoted is Xojo code (not 4D) and it sets the cookie in the browser from a Xojo web app. With Chrome’s developer’s console I can watch the cookie being set when cookies are not being blocked. What I should have understood in your post was that any web app or web server can only determine if a cookie is set by what is passed from the browser in the http header. So if my Xojo web app sets a cookie in the browser, that would not be reflected in the header until the header was updated, which would only happen the next time an exchange occurred between the web app or web server and the browser. Xojo is adding the cookies it set since receiving the current header to my test. For my idea to work in Xojo or 4D Web Server, there would have to be a way to refresh the http header without refreshing the whole browser window. Perhaps not possible.??. I noticed that eventually the header is updated after the user has invoked a request or 2 to 4D (4d Web Server only talks to the Xojo web app not the browser). Not sure when or what causes the header update during those exchanges. John John Baughman 1331 Auwaiku Street Kailua, Hawaii 96734 (808) 262-0328 john...@hawaii.rr.com ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
I don't know anything about Xojo, but from the code you posted all it seems to do is set a value on the server and immediately read it back. There is no way for the browser to have it yet. The browser only sets a local cookie from a HTTP response containing a "Set-Cookie" header. If cookies are enabled, the *next* request to the same server (with conditions related to the url) will have a "Cookie" header with the value from the previous request. If you wanted to do this in what *appears* to be a single page request, your initial request to the server could return some Javascript that immediately calls back to the server with the cookie value (or reports it not found). Of course, via Javascript, you could also check for the cookie and complain to the user directly that cookies are off without ever reporting the status back to the server. John DeSoi, Ph.D. > On Jun 5, 2018, at 3:51 PM, JOHN BAUGHMAN via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > I will be exploring further why Xojo is seeing the cookie when in fact it has > not been set. I suspect that it is not really reading the cookie from the > browser but instead storing the cookie value for the duration of the current > request. Perhaps it has to, since it really cannot be read from the browser > yet. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
Thanks John. This was my finding as well although I was not using Xojo (if Xojo code is running from within the HTML form than if it programmed to send message to server you may be able to detect it). Essentially the browser does not see anything until 4D ends the code. I have not checked if it does work right after the WEB Send Blob or WEB Send File but before Web Process ends execution. Cheers - Jim Labos - infobase -- Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
John DeSol just pointed out that my idea would not work.. I just did some testing to see what John was talking about. Using Firefox and Xojo I ran the following test with cookies enabled… session.Cookies.Set("testing","test") if Session.Cookies.Value("testing") = "test" then MsgBox "Cookies are NOT disabled: "+Session.Cookies.Value("testing") else MsgBox "Cookies are MAY BE disabled: "+Session.Cookies.Value("testing") end if As expected it reported that cookies were NOT disabled. Watching cookies in the Web Developer Storage tab in Firefox. however, I could not see the cookie until I refreshed the browser. Then I ran the same thing with cookies disabled and surprisingly I got that cookies were still NOT disabled. In the storage tab as before I could not see the cookie, only this time when I refreshed the browser, I still did not see the cookie. After a bit of more testing, I have concluded that as John stated cookies are not in fact set until the browser receives a request subsequent to the one that sets the cookie. I will be exploring further why Xojo is seeing the cookie when in fact it has not been set. I suspect that it is not really reading the cookie from the browser but instead storing the cookie value for the duration of the current request. Perhaps it has to, since it really cannot be read from the browser yet. In any event, I do not think that testing for a test cookie is going to work. At least it will not work using a Xojo web app. John > On Jun 5, 2018, at 10:31 AM, Jim Labos - infobase via 4D_Tech > <4d_tech@lists.4d.com> wrote: > > Thanks John. That was my thought too but I thought maybe someone had some > other "magic" trick. It's clear now there is none in this case. > > It's cumbersome but it will need to be processed as you stated. Since it's > not a single call I can be checking if the Cookie was created on first hit > and proceed from there. > > Cheers > > > > > > - > Jim Labos - infobase > -- > Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html > ** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: https://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ** ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
Thanks John. That was my thought too but I thought maybe someone had some other "magic" trick. It's clear now there is none in this case. It's cumbersome but it will need to be processed as you stated. Since it's not a single call I can be checking if the Cookie was created on first hit and proceed from there. Cheers - Jim Labos - infobase -- Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
> On Jun 5, 2018, at 12:28 PM, Jim Labos - infobase via 4D_Tech > <4d_tech@lists.4d.com> wrote: > > I think that it's a question of the Browser not actually creating the Cookie > until 4D ends the connection/method. If one traces the browser's actions one > only sees the Cookie existing only after 4D sends the response but not > before that. Upon the next connection there is no problem reading the > Cookie. The browser does not create the cookie until it receives your first response that contains a Set-Cookie header. There is no way for you to verify they have cookies enabled/disabled until they make a *second* request where you can see if your value is in the Cookie header. John DeSoi, Ph.D. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
Not know what you are using to set and read cookies I really do no have an answer for you With whatever you are using, can you… Set Cookie: “test=Test" testCookie := Read Cookie “test” If testCookie = “Test” Then Remove Cookie: “test” // cookies are not disabled Else //cookies are probably disabled, alert the user End If John > On Jun 5, 2018, at 7:28 AM, Jim Labos - infobase via 4D_Tech > <4d_tech@lists.4d.com> wrote: > > So I cannot assume that the Cookie was created because of not being able to > read it on same connection, and I cannot assume it wasn't created due to > Cookies being disabled. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
Yes but I am trying to detect if Cookies are "Disabled". If I can read the Cookie it exists and there is no problem. If I cannot read a Cookie then I will create it and that is where the problem lies as one cannot know if it was or not. At least not immediately. That is the predicament. Cheers - Jim Labos - infobase -- Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
I am creating the cookie and immediately after that checking if cookie exists. We handle our own session so no we do not use 4D Session method. So by session I mean the initial call on the server. Using v13 in this application. 1: User hits server with a URL. 2: Server analyzes URL and if it passes checks for presence of cookie. If Cookie does not exist we create it. So at this point if the Cookie gets created all is fine but if user's browser has Cookies disabled 4D does not get an error or any indication of that. If I try and read Cookie on same connection/session the Cookie can indeed exist but it will come back as blank value. If Cookie had previously existed then there is no need to check of course. We only want to check when we create the Cookie. I think that it's a question of the Browser not actually creating the Cookie until 4D ends the connection/method. If one traces the browser's actions one only sees the Cookie existing only after 4D sends the response but not before that. Upon the next connection there is no problem reading the Cookie. So I cannot assume that the Cookie was created because of not being able to read it on same connection, and I cannot assume it wasn't created due to Cookies being disabled. Thanks - Jim Labos - infobase -- Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
you may never be able to detect such a cookie on this configuration. On Tue, 5 Jun 2018 09:43:24 -0700 (MST), Jim Labos - infobase via 4D_Tech wrote: > > I just want to be able to "detect" if c --- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
Jim, Hard to help here without some additional information. By "session" do you mean you are using 4D's automatic session management? What version? You might also show a bit of your code. So you are sending your first response with a "Set-Cookie" header and the *next* request from the browser does not have the value in the "Cookie" header? John DeSoi, Ph.D. > On Jun 4, 2018, at 6:15 PM, Jim Labos - infobase via 4D_Tech > <4d_tech@lists.4d.com> wrote: > > However I would like to detect first if the browser connecting has Cookies > enabled or not. 4D does not have a method for that. Therefore I create a > Cookie (ie: "EXISTS" ) with a value (ie: "YES" ) and then immediately try > and read back the Cookie. If I get back a blank the assumption is Cookies > are disabled and I can deal with a response. > > However when trying to read a cookie that has just been created it always > comes back blank. I think what is happening is that the session is not > finished and therefore the Cookie is not actually created until the session > is over. If I check the cookie's existence after session is over it does > exist. > > So 'am I correct in assuming I cannot read a Cookie until web session is > over? ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
Hi, Don't take this the wrong way but other then telling me what you do on your computer to the cache from browser I don't know what this has to do with the subject matter. I just want to be able to "detect" if cookies are enabled or not. It is not my business what the person connecting to the server why or what he does. I just need to know so I can re-act accordingly. The connection is not with a website but it is to surveys that are mandated by the organization they belong to. So it is in no way an attempt to intrude into their browser history if that is what you are implying. Being able to detect that cookies are disabled can allow us to alert them that they will not be able to participate. It then becomes their choice. Cheers Jim Labos - infobase - Jim Labos - infobase -- Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How does one detect that Cookies are disabled?
regardless of what other info you get back there is one more thing to consider... People like me :) I go into the (on Mac) Library folder and locate cookie, history, cache, and other web related directories. I empty them, the lock them, i.e. the soft are can NOT write into that/those directories. This stops persistent cookies etc from functioning. Stops web sites from downloading "stuff". Once the browser has been exited, there is nothing left from previous web sessions. All of this is in addition to ad blockers, and often indirection through TOR. On Mon, 4 Jun 2018 16:15:52 -0700 (MST), Jim Labos - infobase via 4D_Tech wrote: > This particular Web application sends out emails with embedded ID's in a URL > that uniquely identifies a connection. We have been able to do this because > our customers forward us their list of members etc. > > We have a new customer that must send out the emails themselves and > therefore it is not possible to embed our usual URL. So now I am turning to > "Cookies" and as I am new to the Cookie thing 4D has made it pretty simple > to create and read them. > > However I would like to detect first if the browser connecting has Cookies > enabled or not. 4D does not have a method for that. Therefore I create a > Cookie (ie: "EXISTS" ) with a value (ie: "YES" ) and then immediately try > and read back the Cookie. If I get back a blank the assumption is Cookies > are disabled and I can deal with a response. > > However when trying to read a cookie that has just been created it always > comes back blank. I think what is happening is that the session is not > finished and therefore the Cookie is not actually created until the session > is over. If I check the cookie's existence after session is over it does > exist. > > So 'am I correct in assuming I cannot read a Cookie until web session is > over? > > Thanks > > > > - > Jim Labos - infobase > -- > Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html > ** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: https://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ** --- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: https://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **