Can Javascript do this (follow up)

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

    Can Javascript do this (follow up)

    Hat's off to Kaeli!

    I've been trying for months to get some code that would allow me to
    break the contents out of the main frame in my frame based navigation
    system- and he has almost solved this problem with just a few lines of
    code:

    <a href="#" onClick="window .open(top.frame s
    ['mainFrameName'].document.locat ion,'','');retu rn false;">click here
    to open the document in a new window</a>

    The only thing wrong with this is it only works for web pages already
    on my server. If an external link is displayed in the main frame
    window then this doesn't work- and clicking the "new window" button
    will cause the footer frame to be displayed in the main frame instead.

    I'm not a programmer and this may just be a small fix- if anyone else
    could give me a small hand I would really appreciate it. The function
    is currently in the portal below if you want to see what it is doing.

    Cheers

    Rob






    Hi all,

    I have a web portal I have been developing where I have put together a
    fairly nice navigation system using frames. There is a left hand
    menu, a "main" frame and a header and footer frame. Everything url
    that a user clicks is displayed in the "main frame". I want to give
    my users a function called "New Window" in the footer frame that will
    "break" the main frame and open whatever is there in a separate
    window. This will allow me to add more interesting contents since I
    will no longer be "trapping" people in my frame system.

    The problem is I don't know Javascript and my venture is not funded so
    I can't pay anything right now but I would be very grateful is someone
    knows if there is an easy way to do this. I tried to explain this to
    some programmer friends of mine but I'm not sure we communicated
    because they recommended what seemed like a complimented and involved
    approach.

    At first I was trying to find a function that would "look at" whatever
    iis in the main frame and open it in a new window. I've looked at
    this issue again, and I think it can be solved a different way without
    referirng to "frames" at all. Would it be possible to write a
    function in Javascript that would "remember" whatever the last url
    clicked, and then open this in a new window? I think this would do
    the exact same thing. My portal is at the link below if you want to
    see why I need this.

    Thank you

    Rob


  • Lasse Reichstein Nielsen

    #2
    Re: Can Javascript do this (follow up)

    Rob Gordon <robert@caltrad e.com> writes:
    [color=blue]
    > <a href="#" onClick="window .open(top.frame s
    > ['mainFrameName'].document.locat ion,'','');retu rn false;">click here
    > to open the document in a new window</a>
    >
    > The only thing wrong with this is it only works for web pages already
    > on my server.[/color]
    ....[color=blue]
    > I'm not a programmer and this may just be a small fix- if anyone else
    > could give me a small hand I would really appreciate it.[/color]

    There is no fix. It is part of the security model of most modern
    browsers: code from one domain cannot access the contents of documents
    from other domains.
    There is no workaround (and if there is, expect it to be patched at
    some time, as the bug it is).

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • kaeli

      #3
      Re: Can Javascript do this (follow up)

      In article <5h3vrv8q44tett q516bsehl2jmqpj 0pae4@4ax.com>,
      robert@caltrade .com enlightened us with...[color=blue]
      >
      > I'm not a programmer and this may just be a small fix- if anyone else
      > could give me a small hand I would really appreciate it. The function
      > is currently in the portal below if you want to see what it is doing.
      >[/color]

      Check out the code used by about.com. :)
      It's complicated and I'm not totally sure how they do it (they
      obfuscated the script, which can be deobfuscated, but i don't have time
      right now), but they keep track of where the user is and have a link
      that has target=_top in it.

      --
      ~kaeli~
      Do not taunt Happy Fun Ball!



      Comment

      • kaeli

        #4
        Re: Can Javascript do this (follow up)

        In article <5h3vrv8q44tett q516bsehl2jmqpj 0pae4@4ax.com>,
        robert@caltrade .com enlightened us with...[color=blue]
        > Hat's off to Kaeli!
        >
        > I've been trying for months to get some code that would allow me to
        > break the contents out of the main frame in my frame based navigation
        > system- and he has almost solved this problem with just a few lines of
        > code:
        >[/color]

        Oh, and I'm a girl. :)

        --
        ~kaeli~
        Do not taunt Happy Fun Ball!



        Comment

        • Fabian

          #5
          Re: Can Javascript do this (follow up)

          kaeli hi kitbet:
          [color=blue]
          > In article <5h3vrv8q44tett q516bsehl2jmqpj 0pae4@4ax.com>,
          > robert@caltrade .com enlightened us with...[color=green]
          >> Hat's off to Kaeli!
          >>
          >> I've been trying for months to get some code that would allow me to
          >> break the contents out of the main frame in my frame based navigation
          >> system- and he has almost solved this problem with just a few lines
          >> of code:
          >>[/color]
          >
          > Oh, and I'm a girl. :)[/color]

          Had a look at your site. Love the wallpapers. But the link to the
          blue-tinted tiger needs fixing - it is pointing to its own thumbnail.


          --
          --
          Fabian
          Visit my website often and for long periods!


          Comment

          • kaeli

            #6
            Re: Can Javascript do this (follow up)

            In article <bponag$1q9db4$ 1@ID-174912.news.uni-berlin.de>,
            lajzar@hotmail. com enlightened us with...[color=blue][color=green]
            > >
            > > Oh, and I'm a girl. :)[/color]
            >
            > Had a look at your site. Love the wallpapers. But the link to the
            > blue-tinted tiger needs fixing - it is pointing to its own thumbnail.
            >[/color]


            Thanks!
            [color=blue]
            >[/color]

            --
            --
            ~kaeli~
            Bakers trade bread recipes on a knead-to-know basis.



            Comment

            • Rob Gordon

              #7
              Re: Can Javascript do this (follow up)

              On Sat, 22 Nov 2003 16:57:05 -0600, kaeli[color=blue][color=green][color=darkred]
              >> > Oh, and I'm a girl. :)[/color][/color][/color]

              Well you certainly are a smart girl! I'll check out the About site.
              Would a possible approach be for a Javascript program that could
              "remember" the last url clicked for the main frame? Anyway thanks for
              your help.

              Rob

              Comment

              • Rob Gordon

                #8
                Re: Can Javascript do this (follow up)

                On Sat, 22 Nov 2003 15:21:50 -0600, kaeli wrote:

                Check out the code used by about.com. :)It's complicated and I'm not
                totally sure how they do it (they obfuscated the script, which can be
                deobfuscated, but i don't have time >right now), but they keep track
                of where the user is and have a link >that has target=_top in it.
                ***************
                Hi Miss Kaeli- or whoever else might have thoughts on this.

                I checked out "about.com" and I am pretty sure that is "frame
                branding" - which isn't exactly what I want. I thought I remembered
                seeing that in Java Script source and just went back and found it:


                While I was there I found a script much closer to my needs- It allows
                you to navigate a frame from another frame with forward and back
                buttons- but no "new window" and it probably can't do external links
                either.


                Any creative or "out of the box" solutions to this are also welcome.

                Cheers

                Rob


                Comment

                • kaeli

                  #9
                  Re: Can Javascript do this (follow up)

                  In article <3u20svobib1eqv aslvjrgd3pjgmqt dr4hd@4ax.com>,
                  robert@caltrade .com enlightened us with...[color=blue]
                  > On Sat, 22 Nov 2003 16:57:05 -0600, kaeli[color=green][color=darkred]
                  > >> > Oh, and I'm a girl. :)[/color][/color]
                  >
                  > Well you certainly are a smart girl! I'll check out the About site.
                  > Would a possible approach be for a Javascript program that could
                  > "remember" the last url clicked for the main frame? Anyway thanks for
                  > your help.
                  >
                  > Rob
                  >[/color]

                  I honestly don't know a way b/c of security concerns, but the user can
                  always open the link in the new window themselves by right-clicking and
                  choosing "open link in new window". :)

                  Good luck!

                  --
                  --
                  ~kaeli~
                  Press any key to continue or any other key to quit



                  Comment

                  Working...