Jump to end of page in NOSCRIPT block (skip rest of page)?

Discussion in 'HTML' started by VanguardLH, Feb 27, 2011.

  1. VanguardLH

    VanguardLH Guest

    If the user's web browser happens to go into a <NOSCRIPT>...</NOSCRIPT>
    block (because scripting isn't supported or is disabled), I don't want
    anything else of the HTML document rendered (as it would be superfluous
    since the site demands the use of scripts). So I have something like (a
    very simplistic model shown here):

    <HTML>
    <BODY>
    <NOSCRIPT>
    NOSCRIPT block code
    </NOSCRIPT>
    <BR /><HR />
    Other HTML code
    </BODY>
    </HTML>

    If scripting is disabled and the user visits this page, they'll see:

    NOSCRIPT block code
    Other HTML code

    Nope, don't want anything outside the NOSCRIPT block to get rendered.
    So I need something like:

    <HTML>
    <BODY>
    <NOSCRIPT>
    NOSCRIPT block code
    {something here to *automatically* jump to skiptoend anchor)
    </NOSCRIPT>
    <BR /><HR />
    Other HTML code
    <A name="#skiptoend></A>
    </BODY>
    </HTML>

    I used the concept of an anchor since that gives a location in the
    document of where to jump. However, for the {something} statement, I
    can't just use:

    <A href="#skiptoend">Skip to End of Page</A>

    since that would present the link but not actually jump to the anchor on
    the page. The user would have to click and then it would be too late as
    they would already see:

    NOSCRIPT block code
    /Skip to End of Page/ <-- a link
    Other HTML code

    I want only the NOSCRIPT block to get executed and nothing else that may
    be later in the HTML document if scripting is disabled. Obviously it
    can't be a script that does a goto equivalent command since this is a
    NOSCRIPT block. I don't want halt rendering to present a hyperlink to
    an anchor or alert box (the user shouldn't have to click on anything to
    finish the rendering of the document when scripting is disabled). I
    can't see an attribute that could be added in the anchor with href to
    make an *automatic* jump to where the anchor is defined.

    Either the simple non-scripted HTML code inside the NOSCRIPT block would
    somehow terminate the document (so nothing thereafter gets executed) or
    somehow does the equivalent of a goto command (which is why I thought of
    an automatic jump to an anchor). Is there anything within simple
    non-scripted HTML that will do this?

    Or am I stuck with having to use scripting, if supported, to load a
    different document and position the NOSCRIPT block at the end so it
    happens to drop off by its position at the end of the page, as in:

    <HTML>
    <BODY>

    <!-- If scripting is enabled, load other page. -->
    <SCRIPT language="Javascript" type="text/javascript">
    <!-- hide script code if not supported by web browser
    window.location.href = "otherpage.htm";
    // unhide -->
    </SCRIPT>

    <!-- If scripting is disabled, alert user. -->
    <NOSCRIPT>
    Your web browser does not support scripts
    or support for scripts has been disabled.
    </NOSCRIPT>

    </BODY>
    </HTML>

    I'd rather keep it as one document (where the end of the NOSCRIPT block
    somehow exits the document or automatically jumps to the end) rather
    than having to load 2 of them (to eliminate falling through the NOSCRIPT
    block to then render whatever is below it).
     
    VanguardLH, Feb 27, 2011
    #1
    1. Advertising

  2. VanguardLH wrote:

    > If the user's web browser happens to go into a
    > <NOSCRIPT>...</NOSCRIPT> block (because scripting isn't supported or
    > is disabled), I don't want anything else of the HTML document
    > rendered (as it would be superfluous since the site demands the use
    > of scripts).


    The NOSCRIPT element is a rude tool, and it is frowned upon in HTML5 drafts,
    but in simple cases, rude tools can do their job. But this does not look
    like a simple case.

    A logical approach would be to write the page so that document's static
    content is just the content to be shown when scripting is off. (You might
    wrap that inside NOSCRIPT just to be sure that scripting-enabled browsers
    don't show it even for a fraction of a second.) And you would have a script
    that dynamically creates the content needed for the scripting-enabled use.
    Depending on the situation, this might be unnecessarily complex, or it might
    be easier than writing it as HTML markup (e.g., if it would contains lots of
    items written according to some pattern).

    Beware that the static content would be all that search engines see.

    > So I need something like:

    - -
    > {something here to *automatically* jump to skiptoend anchor)


    You don't jump in HTML. HTML is a poor lonesome data format, not a
    programming language. And you explicitly want to do something in a situation
    where scripting - a programming language - is not available.

    A simple, maybe too simplistic, approach would be to put all the other
    content but the NOSCRIPT element in a DIV element, set display: none for it
    and turn it to display: block as the first operation in your script.
    Something like the following;

    <style>
    #id { display: none; }
    </style>
    <script>
    function init() {
    document.getElementById("content").style.display = 'block'; }
    </script>
    [...]
    <body onload="init()">
    [...]
    <div id="content">
    [...]
    </div>

    When style sheet support is disabled in the browser or the page style sheet
    is discarded, the content would be visible even when scripting is off, but I
    don't think that's serious - the situation is not very common, and the user
    sees the NOSCRIPT content first anyway.

    > <NOSCRIPT>
    > Your web browser does not support scripts
    > or support for scripts has been disabled.
    > </NOSCRIPT>


    To someone who has willfully disabled scripting for security or efficiency
    reasons, that does not look like a compelling reason to switch it on, does
    it? And if I worked in an office where the company's firewall strips off all
    Javascript, would I be tempted to re-visit the page at home in a more
    liberal environment?

    At least give a hint to the user what he would get if scripting were
    available.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Feb 27, 2011
    #2
    1. Advertising

  3. VanguardLH

    VanguardLH Guest

    Jukka K. Korpela wrote:

    > VanguardLH wrote:
    >
    >> If the user's web browser happens to go into a
    >> <NOSCRIPT>...</NOSCRIPT> block (because scripting isn't supported or
    >> is disabled), I don't want anything else of the HTML document
    >> rendered (as it would be superfluous since the site demands the use
    >> of scripts).

    >
    > The NOSCRIPT element is a rude tool, and it is frowned upon in HTML5 drafts,
    > but in simple cases, rude tools can do their job. But this does not look
    > like a simple case.
    >
    > A logical approach would be to write the page so that document's static
    > content is just the content to be shown when scripting is off. (You might
    > wrap that inside NOSCRIPT just to be sure that scripting-enabled browsers
    > don't show it even for a fraction of a second.) And you would have a script
    > that dynamically creates the content needed for the scripting-enabled use.
    > Depending on the situation, this might be unnecessarily complex, or it might
    > be easier than writing it as HTML markup (e.g., if it would contains lots of
    > items written according to some pattern).


    Alas the front-end or main page is already written and I don't get to
    control its content but might've been able to copy it into this
    script-check page. I just wanted to add a notice if the user
    mistakeningly visited this internal-use-only site with scripting
    disabled (and then skip everything else). That's why I came up with the
    scheme to use javascript to load the other already designed page if
    scripting were enabled but then I have a lead or main page with not much
    in it and I was merely looking to consolidate.

    They don't want to write an alternate no-scripted web page and have
    assumed in the past that scripting would always be enabled for their
    sites (their internal and external ones). I thought I'd add a check
    just to be sure.

    > Beware that the static content would be all that search engines see.


    Now that you mention it, I'll have to define a robot.txt file to request
    search engines NOT index this site. It's for internal-use only although
    access must be across the Internet (i.e., outside the corporate
    network). So maybe using the script to load the real front-end page is
    best since nothing of it would get indexed and there are no links
    pointing to it other than the window.location.href javascript command.

    >> So I need something like:

    > - -
    >> {something here to *automatically* jump to skiptoend anchor)

    >
    > You don't jump in HTML. HTML is a poor lonesome data format, not a
    > programming language. And you explicitly want to do something in a situation
    > where scripting - a programming language - is not available.


    Yeah, I know, but hope springs eternal even when you suspect your hope
    will get dashed. I looked at the attributes for the NOSCRIPT and anchor
    tags but it didn't look promising that anything might be contrived or
    vaguely documented that might perform an automatic jump to an anchor.

    > A simple, maybe too simplistic, approach would be to put all the other
    > content but the NOSCRIPT element in a DIV element, set display: none for it
    > and turn it to display: block as the first operation in your script.
    > Something like the following;
    >
    > <style>
    > #id { display: none; }
    > </style>
    > <script>
    > function init() {
    > document.getElementById("content").style.display = 'block'; }
    > </script>
    > [...]
    > <body onload="init()">
    > [...]
    > <div id="content">
    > [...]
    > </div>


    But showing the other content outside the NOSCRIPT block was what I was
    trying to avoid. I didn't want to confuse the visitors with anything
    other than to notify them that scripting *is* required for using the
    site. No scripting, no entrance.

    > When style sheet support is disabled in the browser or the page style sheet
    > is discarded, the content would be visible even when scripting is off, but I
    > don't think that's serious - the situation is not very common, and the user
    > sees the NOSCRIPT content first anyway.
    >
    >> <NOSCRIPT>
    >> Your web browser does not support scripts
    >> or support for scripts has been disabled.
    >> </NOSCRIPT>

    >
    > To someone who has willfully disabled scripting for security or efficiency
    > reasons, that does not look like a compelling reason to switch it on, does
    > it? And if I worked in an office where the company's firewall strips off all
    > Javascript, would I be tempted to re-visit the page at home in a more
    > liberal environment?
    >
    > At least give a hint to the user what he would get if scripting were
    > available.


    This is an internal-use only site for dispatcher and resource scheduling
    but needs Internet access for off-site access (we figured on setting up
    HTTPS to secure the data but they haven't decided on using VPN or not).
    Except for anonymous access to this script-check page and the first
    selector page (that it now loads if scripting is enabled), users can't
    visit the site unless they login (anonymous access is not permitted to
    the other directories). So the users (of which there may be 1 to 5)
    will very much know what this site is for. This is the case where a
    master car mechanic would know at a glance for what that speciality
    thingamajig in his toolbar is for but no one would have a clue.

    Because the site heavily uses Javascript along with PHP, there is no
    point in visiting it without scripting support in the web browser. I
    just want to check that they didn't leave scripting disabled in their
    web browser when they come to this internal-use site. If scripting is
    disabled then they cannot use this site but I want to give them notice.
    If they don't login, they also don't get to use the site. If they
    disable SSL connects then they won't get the web pages. You can't get
    in without your passkey, no exceptions. No passkey, no entrance. No
    scripting, no entrance.

    Thanks for trying to help. It did help me to learn about the display
    none/block mechanism for future reference.
     
    VanguardLH, Feb 27, 2011
    #3
  4. VanguardLH wrote:

    > Alas the front-end or main page is already written and I don't get to
    > control its content but might've been able to copy it into this
    > script-check page.


    It's rather difficult to suggest an approach without knowing the
    circumstances and restrictions.

    > But showing the other content outside the NOSCRIPT block was what I
    > was trying to avoid.


    Setting display: none for it will do just that, with the usual CSS caveats.
    The unusual caveats contain the point that you need to note that my sketchy
    code was sloppy - I used #id when I meant #content.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Feb 27, 2011
    #4
  5. Gazing into my crystal ball I observed VanguardLH <> writing in
    news:ikd3an$54r$:

    > Because the site heavily uses Javascript along with PHP, there is no
    > point in visiting it without scripting support in the web browser.


    You could do something server side if client side scripting is not
    available, perhaps redirect to a page saying JavaScript is required.

    Send something client side to the server, if the server receives it, then
    client side scripting is available, if not, then redirect.

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, Feb 27, 2011
    #5
  6. On Feb 26, 10:00 pm, VanguardLH <> wrote:
    > If the user's web browser happens to go into a <NOSCRIPT>...</NOSCRIPT>
    > block (because scripting isn't supported or is disabled), I don't want
    > anything else of the HTML document rendered (as it would be superfluous
    > since the site demands the use of scripts).  So I have something like (a
    > very simplistic model shown here):
    >
    > <HTML>
    >   <BODY>
    >     <NOSCRIPT>
    >       NOSCRIPT block code
    >     </NOSCRIPT>
    >     <BR /><HR />
    >     Other HTML code
    >   </BODY>
    > </HTML>
    >
    > If scripting is disabled and the user visits this page, they'll see:
    >
    > NOSCRIPT block code
    > Other HTML code
    >
    > Nope, don't want anything outside the NOSCRIPT block to get rendered.
    > So I need something like:
    >
    > <HTML>
    >   <BODY>
    >     <NOSCRIPT>
    >       NOSCRIPT block code
    >       {something here to *automatically* jump to skiptoend anchor)
    >     </NOSCRIPT>
    >     <BR /><HR />
    >     Other HTML code
    >     <A name="#skiptoend></A>
    >   </BODY>
    > </HTML>
    >
    > I used the concept of an anchor since that gives a location in the
    > document of where to jump.  However, for the {something} statement, I
    > can't just use:
    >
    >   <A href="#skiptoend">Skip to End of Page</A>
    >
    > since that would present the link but not actually jump to the anchor on
    > the page.  The user would have to click and then it would be too late as
    > they would already see:
    >
    > NOSCRIPT block code
    > /Skip to End of Page/  <-- a link
    > Other HTML code
    >
    > I want only the NOSCRIPT block to get executed and nothing else that may
    > be later in the HTML document if scripting is disabled.  Obviously it
    > can't be a script that does a goto equivalent command since this is a
    > NOSCRIPT block.  I don't want halt rendering to present a hyperlink to
    > an anchor or alert box (the user shouldn't have to click on anything to
    > finish the rendering of the document when scripting is disabled).  I
    > can't see an attribute that could be added in the anchor with href to
    > make an *automatic* jump to where the anchor is defined.
    >
    > Either the simple non-scripted HTML code inside the NOSCRIPT block would
    > somehow terminate the document (so nothing thereafter gets executed) or
    > somehow does the equivalent of a goto command (which is why I thought of
    > an automatic jump to an anchor).  Is there anything within simple
    > non-scripted HTML that will do this?
    >
    > Or am I stuck with having to use scripting, if supported, to load a
    > different document and position the NOSCRIPT block at the end so it
    > happens to drop off by its position at the end of the page, as in:
    >
    > <HTML>
    >   <BODY>
    >
    >     <!-- If scripting is enabled, load other page. -->
    >     <SCRIPT language="Javascript" type="text/javascript">
    >     <!-- hide script code if not supported by web browser
    >       window.location.href = "otherpage.htm";
    >     // unhide -->
    >     </SCRIPT>
    >
    >     <!-- If scripting is disabled, alert user. -->
    >     <NOSCRIPT>
    >       Your web browser does not support scripts
    >       or support for scripts has been disabled.  
    >     </NOSCRIPT>
    >
    >   </BODY>
    > </HTML>
    >
    > I'd rather keep it as one document (where the end of the NOSCRIPT block
    > somehow exits the document or automatically jumps to the end) rather
    > than having to load 2 of them (to eliminate falling through the NOSCRIPT
    > block to then render whatever is below it).


    I forget the exact syntax etc but surely you could use a class for
    nodisplay
     
    Helpful person, Feb 28, 2011
    #6
  7. VanguardLH

    Tim Streater Guest

    In article
    <>,
    Helpful person <> wrote:

    [hundreds of lines snipped]

    Dear Hopeless person,

    I don't know what your "helpful"addition might have been as you left
    hundreds of lines of unsnipped stuff there, and I saw no reason to
    scroll down.

    --
    Tim

    "That excessive bail ought not to be required, nor excessive fines imposed,
    nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
     
    Tim Streater, Feb 28, 2011
    #7
  8. VanguardLH

    dorayme Guest

    In article
    <>,
    Tim Streater <> wrote:

    > In article
    > <>,
    > Helpful person <> wrote:
    >
    > [hundreds of lines snipped]


    Google Groupers do this as a matter of course because on GG, the
    interface hides them and gives the reader an option to see.
    Telling a GG to quote properly just gets an uncomprehending blank
    stare. Not nice for those of us with newsreaders! One could just
    filter all GGs except that not all GG are worthless lost causes.

    --
    dorayme
     
    dorayme, Feb 28, 2011
    #8
  9. VanguardLH

    Tim Streater Guest

    In article <>,
    dorayme <> wrote:

    > In article
    > <>,
    > Tim Streater <> wrote:
    >
    > > In article
    > > <>,
    > > Helpful person <> wrote:
    > >
    > > [hundreds of lines snipped]

    >
    > Google Groupers do this as a matter of course because on GG, the
    > interface hides them and gives the reader an option to see.


    Are you sure? I think this is so when the GG-er is *viewing* a thread,
    and its posts, but when you *reply* to one you get the full montey, the
    whole ball of wax, everything. So I assert that it's quite possible for
    the soppy date to trim appropriately.

    --
    Tim

    "That excessive bail ought not to be required, nor excessive fines imposed,
    nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
     
    Tim Streater, Feb 28, 2011
    #9
  10. VanguardLH

    dorayme Guest

    In article
    <>,
    Tim Streater <> wrote:

    > In article <>,
    > dorayme <> wrote:
    >
    > > In article
    > > <>,
    > > Tim Streater <> wrote:
    > >
    > > > In article
    > > > <>,
    > > > Helpful person <> wrote:
    > > >
    > > > [hundreds of lines snipped]

    > >
    > > Google Groupers do this as a matter of course because on GG, the
    > > interface hides them and gives the reader an option to see.

    >
    > Are you sure? I think this is so when the GG-er is *viewing* a thread,
    > and its posts, but when you *reply* to one you get the full montey, the
    > whole ball of wax, everything. So I assert that it's quite possible for
    > the soppy date to trim appropriately.


    I was not meaning to imply that anyone, including a GG, could not
    trim and the trimmed not appear. It is that they don't because
    they have less motivation, the G interface often hiding quoted
    text that has not been edited - yes, even though it shows up when
    you are in the act of replying. And placing it under a link that
    says "- Show quoted text -", clicking of which reveals it in
    full. Quite clever really. But all this is absolutely infuriating
    to those of us with half decent newsreaders!

    I remember the good Els, (remember Els?), very patiently
    explaining to GGs how to edit their posts on quite a few
    occasions. Others would explain what would happen to them if they
    were ever caught live. <g>

    --
    dorayme
     
    dorayme, Mar 1, 2011
    #10
  11. VanguardLH

    Lewis Guest

    In message <>
    dorayme <> wrote:
    > not all GG are worthless lost causes.


    Sez you

    --
    Do not meddle in the affairs of Dragons for you are crunchy and taste
    good with ketchup
     
    Lewis, Mar 2, 2011
    #11
  12. VanguardLH

    dorayme Guest

    In article <>,
    Lewis <> wrote:

    > In message <>
    > dorayme <> wrote:
    > > not all GG are worthless lost causes.

    >
    > Sez you


    But I can prove it beyond reasonable doubt, certainly on the
    balance of probabilities. Reflect on the meaning of "some" and
    "not all".

    So put up a substantial amount of a bet, we get an escrow setup
    and we appoint a panel of proven reasonable and fair minded
    people and let's go. I never ever can get any fluce off any of
    you wild-talking usenet guys so I won't hold my breath. <g>

    --
    dorayme
     
    dorayme, Mar 2, 2011
    #12
  13. VanguardLH

    Lewis Guest

    In message <>
    dorayme <> wrote:
    > In article <>,
    > Lewis <> wrote:


    >> In message <>
    >> dorayme <> wrote:
    >> > not all GG are worthless lost causes.

    >>
    >> Sez you


    > But I can prove it beyond reasonable doubt, certainly on the
    > balance of probabilities. Reflect on the meaning of "some" and
    > "not all".


    > So put up a substantial amount of a bet, we get an escrow setup
    > and we appoint a panel of proven reasonable and fair minded
    > people and let's go. I never ever can get any fluce off any of
    > you wild-talking usenet guys so I won't hold my breath. <g>


    We'd never agree on the panel since my very definition of reasonable and
    fair-minded would require that they have kill-filed googlegroups posts.

    Alas, an impasse.

    --
    I want a refund, I want a light, I want a reason for all this night
    after night after night after night
     
    Lewis, Mar 2, 2011
    #13
  14. VanguardLH

    dorayme Guest

    In article <>,
    Lewis <> wrote:

    > In message <>
    > dorayme <> wrote:
    > > In article <>,
    > > Lewis <> wrote:

    >
    > >> In message <>
    > >> dorayme <> wrote:
    > >> > not all GG are worthless lost causes.
    > >>
    > >> Sez you

    >
    > > But I can prove it beyond reasonable doubt, certainly on the
    > > balance of probabilities. Reflect on the meaning of "some" and
    > > "not all".

    >
    > > So put up a substantial amount of a bet, we get an escrow setup
    > > and we appoint a panel of proven reasonable and fair minded
    > > people and let's go. I never ever can get any fluce off any of
    > > you wild-talking usenet guys so I won't hold my breath. <g>

    >
    > We'd never agree on the panel since my very definition of reasonable and
    > fair-minded would require that they have kill-filed googlegroups posts.
    >


    I am mildly surprised that you would admit to such
    unreasonableness publicly! This is like betting with someone that
    X is bigger than 4 feet wide and adding that your definition of X
    includes the idea of more than 4 feet wide.

    > Alas, an impasse.


    Not of my making. I would have thought the criteria for *worth*
    would be a rich set of things that could easily overwhelm such
    lone oddities as ignorance of usenet and using GG.

    --
    dorayme
     
    dorayme, Mar 2, 2011
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William.R.Reisen
    Replies:
    2
    Views:
    435
    Alan Wood
    Jul 25, 2003
  2. morrell
    Replies:
    1
    Views:
    963
    roy axenov
    Oct 10, 2006
  3. scad
    Replies:
    4
    Views:
    958
    James Kanze
    May 28, 2009
  4. Mel
    Replies:
    1
    Views:
    82
    Joakim Braun
    Jan 19, 2005
  5. Eadwine Rose
    Replies:
    2
    Views:
    214
    Eadwine Rose
    Oct 15, 2006
Loading...

Share This Page