Help for a javascript decrepit

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

    Help for a javascript decrepit

    Hey all,

    I'm trying to get a java bookmark to work from my browsers address field
    which is supposed to send a prefix + reload the current page from my proxy
    &
    return a special view depending on the prefix. "src=source , dbug=debug,
    bypass=ignore all filters" etc....

    So what is wrong with these? I'm only listing two.

    I have tried
    "javascript:doc ument.nolocatio n="http://src//"+document.nolo cation.href.sub
    string(7);"

    &

    "javascript:doc ument.NoLocatio n="http://dbug//"+document.NoLo cation.href.su
    bstring(7);"

    I keep getting:
    Error: document.noloca tion has no properties
    Source File:

    javascript:docu ment.nolocation ="http://src.."+document .nolocation.hre f.subst
    ring(7);
    Line: 1

    Thanks in advance.

    DP

    --
    Lucrum gaudium
    "Profit is happiness!"


  • Stuart Palmer

    #2
    Re: Help for a javascript decrepit

    Firstly Javascript isn't Java.

    What are 'nolocation' and 'NoLocation'?

    I personally don't get what you are trying to do can you explain in more
    detail please? Give example of the urls you have when you start and what you
    are wanting to get and how you are wanting to get them....drop down/link etc
    might help)

    Cheers

    Stu

    "splatter" <me@me.net> wrote in message
    news:L8Rkb.7$8j 5.5285@news.usw est.net...[color=blue]
    > Hey all,
    >
    > I'm trying to get a java bookmark to work from my browsers address[/color]
    field[color=blue]
    > which is supposed to send a prefix + reload the current page from my[/color]
    proxy[color=blue]
    > &
    > return a special view depending on the prefix. "src=source , dbug=debug,
    > bypass=ignore all filters" etc....
    >
    > So what is wrong with these? I'm only listing two.
    >
    > I have tried
    >[/color]
    "javascript:doc ument.nolocatio n="http://src//"+document.nolo cation.href.sub[color=blue]
    > string(7);"
    >
    > &
    >
    >[/color]
    "javascript:doc ument.NoLocatio n="http://dbug//"+document.NoLo cation.href.su[color=blue]
    > bstring(7);"
    >
    > I keep getting:
    > Error: document.noloca tion has no properties
    > Source File:
    >
    >[/color]
    javascript:docu ment.nolocation ="http://src.."+document .nolocation.hre f.subst[color=blue]
    > ring(7);
    > Line: 1
    >
    > Thanks in advance.
    >
    > DP
    >
    > --
    > Lucrum gaudium
    > "Profit is happiness!"
    >
    >[/color]


    Comment

    • splatter

      #3
      Re: Help for a javascript decrepit

      >[color=blue]
      > "splatter" <me@me.net> wrote in message
      > news:L8Rkb.7$8j 5.5285@news.usw est.net...[color=green]
      > > Hey all,
      > >
      > > I'm trying to get a java bookmark to work from my browsers address[/color]
      > field[color=green]
      > > which is supposed to send a prefix + reload the current page from my[/color]
      > proxy[color=green]
      > > &
      > > return a special view depending on the prefix. "src=source ,[/color][/color]
      dbug=debug,[color=blue][color=green]
      > > bypass=ignore all filters" etc....
      > >
      > > So what is wrong with these? I'm only listing two.
      > >
      > > I have tried
      > >[/color]
      >[/color]
      "javascript:doc ument.nolocatio n="http://src//"+document.nolo cation.href.sub[color=blue][color=green]
      > > string(7);"
      > >
      > > &
      > >
      > >[/color]
      >[/color]
      "javascript:doc ument.NoLocatio n="http://dbug//"+document.NoLo cation.href.su[color=blue][color=green]
      > > bstring(7);"
      > >
      > > I keep getting:
      > > Error: document.noloca tion has no properties
      > > Source File:
      > >
      > >[/color]
      >[/color]
      javascript:docu ment.nolocation ="http://src.."+document .nolocation.hre f.subst[color=blue][color=green]
      > > ring(7);
      > > Line: 1
      > >
      > > Thanks in advance.
      > >
      > > DP[/color][/color]

      "Stuart Palmer" <tryandspamme@y oucant.com> wrote in message
      news:bn0r3r$12j a$1@sp15at20.hu rsley.ibm.com.. .[color=blue]
      > Firstly Javascript isn't Java.
      >
      > What are 'nolocation' and 'NoLocation'?
      >
      > I personally don't get what you are trying to do can you explain in more
      > detail please? Give example of the urls you have when you start and what[/color]
      you[color=blue]
      > are wanting to get and how you are wanting to get them....drop down/link[/color]
      etc[color=blue]
      > might help)
      >
      > Cheers
      >
      > Stu[/color]

      Top post fixed.

      There is no URL Stu. What I am trying to do is have a bookmark in my browser
      that when clicked opens this location in the address bar:
      "javascript:doc ument.nolocatio n="http://src//"+document.nolo cation.href.sub s
      tring(7);"

      Which is supposed to pass the prefix http://src// while reloading the
      currently viewed page. The result is then caught by my proxy and is supposed
      to return with a reformatted view of the page depending on the command
      passed between the "//..//". This is all documented by my proxys help file.
      The only problem is the command they are using is not recognized and I am
      getting a undefined variable error.

      So my question is, what am I doing wrong?

      DP





      Comment

      • Richard Cornford

        #4
        Re: Help for a javascript decrepit

        "splatter" <me@me.net> wrote in message
        news:M%Tkb.24$8 j5.11183@news.u swest.net...
        <snip>[color=blue][color=green]
        >>I personally don't get what you are trying to do can you
        >>explain in more detail please? ...[/color][/color]
        <snip>[color=blue]
        >Top post fixed.[/color]

        Fair enough, but there are good arguments for also trimming material
        that you are not directly responding to rather that quoting the entire
        preceding thread verbatim.
        [color=blue]
        >There is no URL Stu. What I am trying to do is have a bookmark
        >in my browser that when clicked opens this location in the
        >address bar:
        >"javascript:do cument.nolocati on="http://src//"+document.
        > nolocation.href .substring(7);"
        >
        >Which is supposed to pass the prefix http://src// while
        >reloading the currently viewed page. ...[/color]
        <snip>

        In a normal browser DOM there is no document.noloca tion object, which
        makes the proxy's suggested javascript URL odd. It is possible that
        your proxy is content inserting/re-writing and under some circumstances
        it will screw around with the document.locati on object and create a
        nolocation property with it, but if you are getting an "object has no
        properties" error that obviously is not currently the case with your
        set-up. (if your proxy is content inserting/re-writing then looking at
        the resulting page source might be necessary to work out what it is up
        to)

        It is the location object that you should be reading and assigning
        values to, but document.locati on is usually not the best choice of
        location objects to use, instead window.location is preferred (though if
        you are working with a known browser that might not be important).
        window.location is a global property so it can be referred to as just -
        location -.

        The next consideration is that the javascript pseudo-protocol URL is
        designed so that a string returned will be used as the contents of a new
        page that replaces the current page. As you have your URL now it is
        returning a string value form the assignment expression. While setting
        the location object should prevent the javascript pseudo-protocol return
        value from replacing the current page it is normal (and probably safer)
        to ensure that the javascript URL returns an undefined value. That is
        easiest achieved by using the - void - operator on the expression. Which
        leaves the javascript URL looking something like:-

        javascript:void (location="http ://src//"+location.href .substring(7));

        You could test that the constructed string is what you expect by using
        the alert function in a similar javascript URL:-

        javascript:aler t("http://src//"+location.href .substring(7));

        Richard.


        Comment

        • Graham J

          #5
          Re: Help for a javascript decrepit

          > There is no URL Stu. What I am trying to do is have a bookmark in my
          browser[color=blue]
          > that when clicked opens this location in the address bar:
          >[/color]
          "javascript:doc ument.nolocatio n="http://src//"+document.nolo cation.href.sub s[color=blue]
          > tring(7);"
          >
          > Which is supposed to pass the prefix http://src// while reloading the
          > currently viewed page. The result is then caught by my proxy and is[/color]
          supposed[color=blue]
          > to return with a reformatted view of the page depending on the command
          > passed between the "//..//". This is all documented by my proxys help[/color]
          file.[color=blue]
          > The only problem is the command they are using is not recognized and I am
          > getting a undefined variable error.
          >
          > So my question is, what am I doing wrong?[/color]

          I could be way off but is it possible that you have your web filtering proxy
          configured to rewrite "document.locat ion" in pages with
          "document.noloc ation" but with a delicious irony you are reading the
          documentation through this proxy and so seeing the instructions rewritten
          too?

          To put it another way, does it work any better with document.locati on in the
          above?






          Comment

          • splatter

            #6
            Re: Help for a javascript decrepit

            Hoorah.. Thanks guys as a matter of fact both of them work

            javascript:docu ment.location=" http://src//"+document.loca tion.href.subst ring
            (7);

            &

            javascript:void (location="http ://src//"+location.href .substring(7));

            Thanks again,

            David P.


            Comment

            Working...