Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #14469 > unrolled thread

Ineffective Firefox cookie

Started byWalter Briscoe <wbriscoe@nospam.demon.co.uk>
First post2012-06-12 21:10 +0100
Last post2012-06-13 15:06 +0200
Articles 4 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  Ineffective Firefox cookie Walter Briscoe <wbriscoe@nospam.demon.co.uk> - 2012-06-12 21:10 +0100
    Re: Ineffective Firefox cookie Gene Wirchenko <genew@ocis.net> - 2012-06-12 14:45 -0700
    Re: Ineffective Firefox cookie JJ <jaejunks_at@_googlemail_dot._com> - 2012-06-12 23:24 +0000
    Re: Ineffective Firefox cookie Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-06-13 15:06 +0200

#14469 — Ineffective Firefox cookie

FromWalter Briscoe <wbriscoe@nospam.demon.co.uk>
Date2012-06-12 21:10 +0100
SubjectIneffective Firefox cookie
Message-ID<b5M+F7U$I61PFwO$@freenetname.co.uk>
I have been kibitzing here for a couple of weeks and now have a question
which is not completely off topic.

I run Firefox 12.0 with Tools/Options/Privacy/Remember history, (It is
another matter that I intended to be less permissive.)

UK sites are now required to say how they use cookies. cf. <http://www.t
heregister.co.uk/2012/05/26/eprivacy_cookie_compliance_begins/>

I regularly use <http://www.tfl.gov.uk/tfl/livetravelnews/realtime/tube/
default.html> and it has a message "Cookies on the Transport for London
website" which has a "Hide Message" button.

When I click that button in IE8, a cookie is set for a year. Firefox
attempts to set the cookie, but does not succeed in doing so.

I am very new to JavaScript and aim to use it for getting information
from websites.

The FAQ recommends "JavaScript The Definitive Guide". I find it an
unreasonably heavy volume at about 1780g and starting at the beginning
took a lot of input with little return. I have not tried JavaScript The
Good Parts. I found "Learning Javascript" useful for a beginner.

I installed Firebug from <http://getfirebug.com/>, put a breakpoint In
"/tfl-global/scripts/tfl-cookies-prompt.js" at setCookie("hide-cookies-
panel", "yes", 365); in function hidePanel() and stepped through to
document.cookie = c_name + "=" + c_value + expires + "; path=/";

How do I tell why that line is ineffective?
I don't yet know how to examine document.cookie. ;)

[I am surprised that Firebug returns to the caller when "Step into
(F11)" is run at
16 document.cookie = c_name + "=" + c_value + expires + "; path=/";
17 }.
Is that optional behavior? I would prefer it to stop at 17 }]

Support for the TfL web site is unlikely to be effective within a
reasonable timescale. ;(
-- 
Walter Briscoe

[toc] | [next] | [standalone]


#14470

FromGene Wirchenko <genew@ocis.net>
Date2012-06-12 14:45 -0700
Message-ID<7tcft7d0ft3nu3h294tltv0adaor5np0u3@4ax.com>
In reply to#14469
On Tue, 12 Jun 2012 21:10:39 +0100, Walter Briscoe
<wbriscoe@nospam.demon.co.uk> wrote:

>I have been kibitzing here for a couple of weeks and now have a question
>which is not completely off topic.
>
>I run Firefox 12.0 with Tools/Options/Privacy/Remember history, (It is
>another matter that I intended to be less permissive.)
>
>UK sites are now required to say how they use cookies. cf. <http://www.t
>heregister.co.uk/2012/05/26/eprivacy_cookie_compliance_begins/>
>
>I regularly use <http://www.tfl.gov.uk/tfl/livetravelnews/realtime/tube/
>default.html> and it has a message "Cookies on the Transport for London
>website" which has a "Hide Message" button.
>
>When I click that button in IE8, a cookie is set for a year. Firefox
>attempts to set the cookie, but does not succeed in doing so.

     How is Tools -- Options -- Privacy tab -- Accept cookies from
sites set?

     If disabled, click on "Exceptions..." and add the site to the
list.  Click on "Allow" rather than "Allow for Session" so that the
cookie will last the year.  This will enable cookies for that site. If
the site is already listed, then be sure that it is set to Allowed
rather than Allowed for Session.  If this does not apply, then I do
not know what your problem is.

     If enabled, click on "Exceptions..." and remove the site from the
exceptions list.  This will enable cookies for that site.  If the site
is not already listed, then I do not know what your problem is.

>I am very new to JavaScript and aim to use it for getting information
>from websites.
>
>The FAQ recommends "JavaScript The Definitive Guide". I find it an
>unreasonably heavy volume at about 1780g and starting at the beginning
>took a lot of input with little return. I have not tried JavaScript The
>Good Parts. I found "Learning Javascript" useful for a beginner.

     I am still learning JavaScript myself.  The simpler books are
fine for an overview, but now, I find I want more.  There are a lot of
basic JavaScript books, and they do not cover much of JavaScript.  My
bias?  I am a professional programmer.  If the simpler books are
enough for you, then well and good.  If you want more, then be
prepared to read thick, heavy books.

>I installed Firebug from <http://getfirebug.com/>, put a breakpoint In
>"/tfl-global/scripts/tfl-cookies-prompt.js" at setCookie("hide-cookies-
>panel", "yes", 365); in function hidePanel() and stepped through to
>document.cookie = c_name + "=" + c_value + expires + "; path=/";
>
>How do I tell why that line is ineffective?
>I don't yet know how to examine document.cookie. ;)

     For one:
          alert(document.cookie);

>[I am surprised that Firebug returns to the caller when "Step into
>(F11)" is run at
>16 document.cookie = c_name + "=" + c_value + expires + "; path=/";
                                               ^^^^^^^
     What is the value of expires?  Is it a string starting with a
semi-colon?

>17 }.
>Is that optional behavior? I would prefer it to stop at 17 }]

     I do not know Firebug, but I have used such debuggers.  I think
that the problem is that line 17 is not a statement.  You step in,
line 16 is next to be executed, you single-step, line 16 is executed,
and that finishes the function.  The next statement to be executed is
presumably in the caller.  I assume you wanted to view the result of
the assignment.  document.cookie is global so you can still look at
it.

>Support for the TfL web site is unlikely to be effective within a
>reasonable timescale. ;(

     What do you mean here?  That their support people will not
respond in a timely manner?  Or are you referring to software of yours
dealing with their site?

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#14474

FromJJ <jaejunks_at@_googlemail_dot._com>
Date2012-06-12 23:24 +0000
Message-ID<XnsA071415512FE0jaejunksgooglemailco@0.0.0.29>
In reply to#14469
Walter Briscoe <wbriscoe@nospam.demon.co.uk> wrote in news:b5M+F7U$I61PFwO
$@freenetname.co.uk:

> I installed Firebug from <http://getfirebug.com/>, put a breakpoint In
> "/tfl-global/scripts/tfl-cookies-prompt.js" at setCookie("hide-cookies-
> panel", "yes", 365); in function hidePanel() and stepped through to
> document.cookie = c_name + "=" + c_value + expires + "; path=/";
> 
> How do I tell why that line is ineffective?

It's effective. After a TRACE or STEP, the highlight would go to the next 
statement. But since there is no more after that, the next one is searched 
after the call to that function, which is the caller.

Just inspect the document.cookie or window.document.cookie to see the 
result.

[toc] | [prev] | [next] | [standalone]


#14484

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2012-06-13 15:06 +0200
Message-ID<1597639.oMNUckLgyt@PointedEars.de>
In reply to#14469
Walter Briscoe wrote:

> The FAQ recommends "JavaScript The Definitive Guide". I find it an
> unreasonably heavy volume at about 1780g and starting at the beginning
> took a lot of input with little return. I have not tried JavaScript The
> Good Parts. I found "Learning Javascript" useful for a beginner.

There are probably several books with that title.  If you are recommending a 
book, be precise about it, so that your recommendation can be reviewed.

In general, be precise about everything that you post so as not to waste 
your readers' (and potentially helpers') free time.

<http://www.catb.org/~esr/faqs/smart-questions.html>
 
> I installed Firebug from <http://getfirebug.com/>, put a breakpoint In
> "/tfl-global/scripts/tfl-cookies-prompt.js" at setCookie("hide-cookies-
> panel", "yes", 365); in function hidePanel() and stepped through to
> document.cookie = c_name + "=" + c_value + expires + "; path=/";
> 
> How do I tell why that line is ineffective?
> I don't yet know how to examine document.cookie. ;)

RTFM: <http://getfirebug.com/wiki/index.php/Main_Page> ("Documentation").

You can

  a) point at the property name while debugging
  b) add a Watch expression
  c) inspect the global `document' property value's properties
  d) type `document.cookie' or `console.log(document.cookie)' followed
     by the Enter/Return key in the command line in Firebug's "Console" tab
  e) Use console.log() in your code.

And probably I forgot to mention something.

Since the value is domain-specific, you can do (d) at any time, provided the 
script does not redirect to another domain.


HTH

PointedEars
-- 
var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
)  // Plone, register_function.js:16

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web