Passing parameters to style sheet, e.g. "mystyle.css?color=ffffff"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roger

    Passing parameters to style sheet, e.g. "mystyle.css?color=ffffff"

    How can I pass parameters to a style sheet? I have noticed a couple
    of sites are now passing variables to the style sheet, which appear to
    be substituted at run time. For example:

    <link rel="stylesheet " type="text/css"
    href="mystyle.c ss?color=ffffff ">

    I have seen references in my temp Internet file directory that
    indicates this is possible, but I can't find any documentation how to
    do it.

    I suspect the mystyle.css page is really an asp or aspx page they does
    a substitution with via something like <%=
    Request.QuerySt ring("color")%> , but I can't get this to work.

    Thanks,

    Roger
  • Harlan Messinger

    #2
    Re: Passing parameters to style sheet, e.g. &quot;mystyle.c ss?color=ffffff &quot;


    "Roger" <rjensen@viewce ntral.com> wrote in message
    news:ef352b5e.0 410200833.709ff ea8@posting.goo gle.com...[color=blue]
    > How can I pass parameters to a style sheet? I have noticed a couple
    > of sites are now passing variables to the style sheet, which appear to
    > be substituted at run time. For example:
    >
    > <link rel="stylesheet " type="text/css"
    > href="mystyle.c ss?color=ffffff ">
    >
    > I have seen references in my temp Internet file directory that
    > indicates this is possible, but I can't find any documentation how to
    > do it.
    >
    > I suspect the mystyle.css page is really an asp or aspx page they does
    > a substitution with via something like <%=
    > Request.QuerySt ring("color")%> , but I can't get this to work.[/color]

    I'd think it would have to be that. But then you'd need to configure your
    web site to treat requests with the .CSS extension as ASP(X) requests, and
    would need to add

    <% Response.Conten tType = "text/css" %>

    at the top of the CSS file. Alternatively you could skip the .CSS extension,
    and have

    href="mystyle.a sp?color=#fffff f"

    Then you could skip the server configuration part and just set the content
    type and rename mystyle.css to mystyle.asp.


    Comment

    • rjensen@viewcentral.com

      #3
      Re: Passing parameters to style sheet, e.g. &quot;mystyle.c ss?color=ffffff &quot;

      Thanks Harlan. Simply using an .asp page instead of a .css page allows
      the query string process and appears to work, at least under IE 6.

      Do you think any browsers are sensitive to the .css extension, or
      should all browswers access any style sheet reference, as long as the
      reference in the html file is correct and the style sheet has the
      correct syntax?

      Thanks again,

      Roger

      Comment

      • Harlan Messinger

        #4
        Re: Passing parameters to style sheet, e.g. &quot;mystyle.c ss?color=ffffff &quot;


        <rjensen@viewce ntral.com> wrote in message
        news:1098294591 .353601.40810@c 13g2000cwb.goog legroups.com...[color=blue]
        > Thanks Harlan. Simply using an .asp page instead of a .css page allows
        > the query string process and appears to work, at least under IE 6.
        >
        > Do you think any browsers are sensitive to the .css extension, or
        > should all browswers access any style sheet reference, as long as the
        > reference in the html file is correct and the style sheet has the
        > correct syntax?[/color]

        The latter. All the browser does is send a request for the named resource
        back to the server verbatim. The same technique works for dynamically
        generating images, by putting the URL for an image-generating ASP file in
        the SRC attribute of an IMG tag.

        Comment

        • StarQuake

          #5
          Re: Passing parameters to style sheet, e.g. &quot;mystyle.c ss?color=ffffff &quot;

          Harlan Messinger wrote:[color=blue]
          > <rjensen@viewce ntral.com> wrote in message
          > news:1098294591 .353601.40810@c 13g2000cwb.goog legroups.com...
          >[color=green]
          >>Thanks Harlan. Simply using an .asp page instead of a .css page allows
          >>the query string process and appears to work, at least under IE 6.
          >>
          >>Do you think any browsers are sensitive to the .css extension, or
          >>should all browswers access any style sheet reference, as long as the
          >>reference in the html file is correct and the style sheet has the
          >>correct syntax?[/color]
          >
          >
          > The latter. All the browser does is send a request for the named resource
          > back to the server verbatim. The same technique works for dynamically
          > generating images, by putting the URL for an image-generating ASP file in
          > the SRC attribute of an IMG tag.
          >[/color]
          yes, It Works (tm) but is it The Right Way (tm)



          --
          -----------------------------------------
          Visit my site! http://solid.bounceme.net
          -----------------------------------------

          Comment

          • Christoph Paeper

            #6
            Re: Passing parameters to style sheet, e.g. &quot;mystyle.c ss?color=ffffff &quot;

            StarQuake <starquake@anti spam.tiscali.nl >:[color=blue]
            >[/color]
            | href="mystyle.a sp?color=#fffff f"[color=blue]
            >
            > yes, It Works (tm) but is it The Right Way (tm)[/color]

            On the web file extensions are meaningless, MIME types count. (IE
            sometimes thinks it knows better, though.) In URLs you should not mention
            your serverside technonlogies, so .php, .asp etc should, if at all, only
            occur if it is a link to the non-interpreted source.

            --
            No sig today, my .sig has gone away
            The divider stands forlorn, a symbol of the dawn
            No sig today, it seems a common sight
            But people reading by don't know the reason why

            Comment

            • Brian

              #7
              Re: Passing parameters to style sheet, e.g. &quot;mystyle.c ss?color=ffffff &quot;

              rjensen@viewcen tral.com wrote:[color=blue]
              > Thanks Harlan.[/color]

              For what? Please include a bit (but not all) of the message you're
              replying to so that we have some context.
              [color=blue]
              > Simply using an .asp page instead of a .css page allows the query
              > string process and appears to work, at least under IE 6.
              >
              > Do you think any browsers are sensitive to the .css extension,[/color]

              In a www client (e.g., a web browser), there is no file extension, only
              a url and a mime type to tell the client what kind of resource it is.
              [color=blue]
              > should all browswers access any style sheet reference, as long as the
              > reference in the html file is correct and the style sheet has the
              > correct syntax?[/color]

              They should all do it, and most do. MSIE/Win -- which is not really a
              browser, but sort of acts like one at times -- violates the standard by
              ignoring the mime type in favor of content sniffing. MS claims that the
              latest "security" [1] pack fixes this, but appears to introduce other
              broken stuff to replace what they've fixed. In particular, they advise
              web authors to use the correct file extension for web resources. That's
              utter nonsense on the client end; as I said above, there is no file
              extension to interpret.

              Note that some versions of Firefox and Opera have begun to copy
              MSIE/Win's broken behavior with regard to css, overriding text/plain and
              treating it as css if that's what it appears to be.


              [1] It's hard to use "MS" and "security" in the same sentence without
              falling off my chair in hysterical laughter.

              --
              Brian (remove "invalid" to email me)

              Comment

              • Christoph Paeper

                #8
                Re: Passing parameters to style sheet, e.g. &quot;mystyle.c ss?color=ffffff &quot;

                Brian <usenet3@juliet remblay.com.inv alid>:[color=blue]
                >
                > MSIE/Win (...) violates the standard by
                > ignoring the mime type in favor of content sniffing.[/color]

                Actually IE doesn't ignore the MIME type completely, but uses it as just a
                minor type indicator. Sad enough.

                --
                "Space may be the final frontier,
                but it's made in a Hollywood basement."

                Red Hot Chili Peppers - Californication

                Comment

                • Harlan Messinger

                  #9
                  Re: Passing parameters to style sheet, e.g. &quot;mystyle.c ss?color=ffffff &quot;


                  "StarQuake" <starquake@anti spam.tiscali.nl > wrote in message
                  news:2tns6qF21u smlU1@uni-berlin.de...[color=blue]
                  > Harlan Messinger wrote:[color=green]
                  > > <rjensen@viewce ntral.com> wrote in message
                  > > news:1098294591 .353601.40810@c 13g2000cwb.goog legroups.com...
                  > >[color=darkred]
                  > >>Thanks Harlan. Simply using an .asp page instead of a .css page allows
                  > >>the query string process and appears to work, at least under IE 6.
                  > >>
                  > >>Do you think any browsers are sensitive to the .css extension, or
                  > >>should all browswers access any style sheet reference, as long as the
                  > >>reference in the html file is correct and the style sheet has the
                  > >>correct syntax?[/color]
                  > >
                  > >
                  > > The latter. All the browser does is send a request for the named[/color][/color]
                  resource[color=blue][color=green]
                  > > back to the server verbatim. The same technique works for dynamically
                  > > generating images, by putting the URL for an image-generating ASP file[/color][/color]
                  in[color=blue][color=green]
                  > > the SRC attribute of an IMG tag.
                  > >[/color]
                  > yes, It Works (tm) but is it The Right Way (tm)[/color]

                  Absolutely. It's a URL, there's no restriction on what kind of URL it is,
                  and there's *no reason* why the browser should pre-inspect it. It's none of
                  the browser's business.

                  Comment

                  • Alan J. Flavell

                    #10
                    Re: Passing parameters to style sheet, e.g. &quot;mystyle.c ss?color=ffffff &quot;

                    On Wed, 20 Oct 2004, Christoph Paeper wrote:
                    [color=blue]
                    > Brian <usenet3@juliet remblay.com.inv alid>:[color=green]
                    > >
                    > > MSIE/Win (...) violates the standard by
                    > > ignoring the mime type in favor of content sniffing.[/color]
                    >
                    > Actually IE doesn't ignore the MIME type completely,[/color]

                    Prior to XP SP2, MS documents its violation of the mandatory HTTP
                    requirements for a specific list of 26 MIME types, although it hints
                    that it reserves the right to compromise other MIME types too, if and
                    when it feels like it.

                    Gain technical skills through documentation and training, earn certifications and connect with the community


                    Indeed when I tried it back then (in NT4) it did indeed behave as
                    documented. If you chose some preposterous MIME type which MS hadn't
                    yet heard of, you could associate it with an appropriate helper
                    application, and, under these limited conditions, IE would give a
                    remarkable impression of being a WWW browser. For example, I told
                    MSIE that it should open documents of type application/xhtml+xml by
                    using Mozilla. This worked fine: behind the scenes, IE saves the data
                    to a temporary file, and then fires up Mozilla to open the document
                    from its temporary file location.

                    I have some discussion at


                    But surely you're going to ask why not browse the web using Mozilla in
                    the first place, and I could only agree. I basically reserve IE for
                    visits to Windows Update these days.

                    It's clear that in XP SP2 they haven't actually solved the problem
                    that they had created before; but they seem to have introduced a new
                    bunch of brokenness. I haven't seen any clear documentation yet of
                    what they claim to have done. Just the usual anodyne woffle that MS
                    knows best what the user wants (and by implication that the IETF
                    couldn't tell a security exposure from a hole in the ground. It would
                    be funny if it wasn't so serious.)

                    Comment

                    • Brian

                      #11
                      Re: Passing parameters to style sheet, e.g. &quot;mystyle.c ss?color=ffffff &quot;

                      Brian wrote:
                      [color=blue]
                      > MS claims that the latest "security" [1] pack fixes this[/color]

                      That should be "service pack". So, as it turns out, I don't need to use
                      "security" and "MS" in the same sentence. ;-)

                      --
                      Brian (remove "invalid" to email me)

                      Comment

                      • Brian

                        #12
                        Re: Passing parameters to style sheet, e.g. &quot;mystyle.c ss?color=ffffff &quot;

                        Christoph Paeper wrote:[color=blue]
                        > Brian:
                        >[color=green]
                        >>
                        >> MSIE/Win (...) violates the standard by ignoring the mime type in
                        >> favor of content sniffing.[/color]
                        >
                        >
                        > Actually IE doesn't ignore the MIME type completely, but uses it as
                        > just a minor type indicator.[/color]


                        Before SP2, MSIE *ignored* the MIME type entirely, unless other methods
                        (such as content sniffing) failed.

                        --
                        Brian (remove "invalid" to email me)

                        Comment

                        • Alan J. Flavell

                          #13
                          Re: Passing parameters to style sheet, e.g. &quot;mystyle.c ss?color=ffffff &quot;

                          On Wed, 20 Oct 2004, Brian wrote:
                          [color=blue]
                          > Before SP2, MSIE *ignored* the MIME type entirely,[/color]

                          That's not correct - it's worse than that: they actually /tested/ the
                          MIME type against a list of 26 MIME types before deciding to ignore
                          it. Any remaining MIME types not on that list were (with some bizarre
                          exceptions related to plugins) handled correctly (including, just to
                          rub salt into the wound, content types like application/msword,
                          application/vnd.ms-excel - even text/rtf was not in their hitlist for
                          this IETF-violating behaviour).

                          So, far from "ignoring" the MIME type, they took a close look at it
                          before deciding to violate the interworking mandates by tossing it
                          aside.
                          [color=blue]
                          > unless other methods (such as content sniffing) failed.[/color]

                          Not that either: if content sniffing failed, their last resort still
                          didn't involve the original MIME type (for the dread 26 types on their
                          hit list). Sometimes, however, it involved what they interpreted as
                          the filename extension (which of course for HTTP is defined by the RFC
                          to be irrelevant when there's a MIME type present - which means
                          essentially "all of the time" nowadays).

                          Comment

                          • rjensen@viewcentral.com

                            #14
                            Re: Passing parameters to style sheet, e.g. &quot;mystyle.c ss?color=ffffff &quot;

                            Unfortunately, using an asp page for a style sheet does not appear to
                            work for FireFox v 1.0. If I attempt to reference the style sheet as
                            <link rel="stylesheet " type="text/css" href="mystyle.a sp"> it does not
                            pick up the style sheet. However, the reference <link rel="stylesheet "
                            type="text/css" href="mystyle.c ss"> works fine. Both of these work
                            fine with IE.

                            It appears IE does not seem to care what the extension is for the style
                            sheet, but FireFox does.

                            Roger

                            Comment

                            • Darin McGrew

                              #15
                              Re: Passing parameters to style sheet, e.g. &quot;mystyle.c ss?color=ffffff &quot;

                              <rjensen@viewce ntral.com> wrote:[color=blue]
                              > Unfortunately, using an asp page for a style sheet does not appear to
                              > work for FireFox v 1.0. If I attempt to reference the style sheet as
                              > <link rel="stylesheet " type="text/css" href="mystyle.a sp"> it does not
                              > pick up the style sheet. However, the reference <link rel="stylesheet "
                              > type="text/css" href="mystyle.c ss"> works fine. Both of these work
                              > fine with IE.
                              >
                              > It appears IE does not seem to care what the extension is for the style
                              > sheet, but FireFox does.[/color]

                              The problem isn't ASP per se, nor is it the .asp filename extension. The
                              problem is almost certainly that "mystyle.as p" is being sent with the wrong
                              MIME type.

                              See http://css.nu/faq/ciwas-aFAQ.html#QA05
                              --
                              Darin McGrew, mcgrew@stanford alumni.org, http://www.rahul.net/mcgrew/
                              Web Design Group, darin@htmlhelp. com, http://www.HTMLHelp.com/

                              "It's easier to stay out than to get out." - Mark Twain

                              Comment

                              Working...