Loading ...
Sorry, an error occurred while loading the content.
 

Re: xlink from SVG to HTML anchor in containing page

Expand Messages
  • Jim Ley
    anniea13 wrote in message news:c756pl+f4fg@eGroups.com... ... so a target in the link would seem to be the appropriate solution.
    Message 1 of 18 , May 3, 2004
      "anniea13" <annie@...> wrote in message
      news:c756pl+f4fg@......
      > The problem with an iframe is that if I have a link in SVG that
      > links to some anchor in the HTML page that includes the SVG,
      > the page is loaded in the iframe, and then I have the same page
      > twice - normally and in the iframe.

      so a target in the link would seem to be the appropriate solution.

      > Maybe this is because I use onclick event to jump to the link, e.g.
      > onclick="location.href='test.html#anchor'", because, as I
      > said in my initial post, the xlink:href doesn't work for some reason.

      That's silly, I can't see the original post on gmane (it starts with Peter
      Kalev's response) could you say what your actual aims are?

      This works fine for me:

      http://jibbering.com/2004/5/iframe.html

      iframe.html
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN">
      <html>
      <head>
      <title>Iframe SVG test</title>
      </head>
      <style>
      p {margin-bottom:900px};
      </style>
      <body>
      <h1>Iframe SVG Test</h1>
      <iframe src="iframe.svg" style="height:300px;width:100%"></iframe>
      <a name="chicken">Chicken</a>
      <p>   </p>
      <a name="artichoke">Artichoke</a>ARTICHOKE
      <p>   </p>
      <p>   </p>
      <a name="frog">Frog</a>FROG
      </body>
      </html>

      iframe.svg:

      <svg><text x="100" y="100">
      <a xlink:href="iframe.html#chicken" target="top"><tspan>Chicken</tspan></a>
      <a xlink:href="iframe.html#artichoke" target="top"><tspan dy="20"
      target="top">Artichoke</tspan></a>
      <a xlink:href="iframe.html#frog" target="top"><tspan dy="20"
      target="top">Frog</tspan></a>
      </text>

      </svg>


      Jim.
    • Jim Ley
      Jim Ley wrote in message news:c75bn1$s9e$1@sea.gmane.org... ... target= top Chicken Sorry, pasted the wrong version
      Message 2 of 18 , May 3, 2004
        "Jim Ley" <jim@...> wrote in message
        news:c75bn1$s9e$1@......
        > <a xlink:href="iframe.html#chicken"
        target="top"><tspan>Chicken</tspan></a>

        Sorry, pasted the wrong version in here...

        <a xlink:href="iframe.html#chicken"
        target="_parent"><tspan>Chicken</tspan></a>

        but named windows do work fine too.

        Jim.
      • anniea13
        Jim Thanks for your answer and example. I think something really strange is happening for me. When I looked at your example on the URL you provided, the links
        Message 3 of 18 , May 3, 2004
          Jim
          Thanks for your answer and example.
          I think something really strange is happening for me.

          When I looked at your example on the URL you provided,
          the links work fine for me.

          But when I copied your code and created local files, and loded them,
          the links are not working!!!
          This is really weird, I don't know what to do!
          Maybe you can help me find out why doesn't it work with files on my
          local?

          BTW, why don't you declare the DTD in your SVG?
          And also the svg and xlink namespaces and all that?
          Also, tspan is not allowed inside the a element in SVG DTD.

          Anyway, I will be really happy if somebody will let me out of the
          confusion with these links I got into.

          My initial aim is to have an SVG that have working links to anchors
          in the embedding HTML document, without javascript (well, this is
          exactly the bit that works on your page, and doesn't work with files
          with exactly the same code on my machine).

          Hoping this mystery will be solved.

          Thank you very much for help.
          Anna

          --- In svg-developers@yahoogroups.com, "Jim Ley" <jim@j...> wrote:
          >
          > "anniea13" <annie@a...> wrote in message
          > news:c756pl+f4fg@e...
          > > The problem with an iframe is that if I have a link in SVG that
          > > links to some anchor in the HTML page that includes the SVG,
          > > the page is loaded in the iframe, and then I have the same page
          > > twice - normally and in the iframe.
          >
          > so a target in the link would seem to be the appropriate solution.
          >
          > > Maybe this is because I use onclick event to jump to the link,
          e.g.
          > > onclick="location.href='test.html#anchor'", because, as I
          > > said in my initial post, the xlink:href doesn't work for some
          reason.
          >
          > That's silly, I can't see the original post on gmane (it starts
          with Peter
          > Kalev's response) could you say what your actual aims are?
          >
          > This works fine for me:
          >
          > http://jibbering.com/2004/5/iframe.html
          >
          > iframe.html
          > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN">
          > <html>
          > <head>
          > <title>Iframe SVG test</title>
          > </head>
          > <style>
          > p {margin-bottom:900px};
          > </style>
          > <body>
          > <h1>Iframe SVG Test</h1>
          > <iframe src="iframe.svg" style="height:300px;width:100%"></iframe>
          > <a name="chicken">Chicken</a>
          > <p>   </p>
          > <a name="artichoke">Artichoke</a>ARTICHOKE
          > <p>   </p>
          > <p>   </p>
          > <a name="frog">Frog</a>FROG
          > </body>
          > </html>
          >
          > iframe.svg:
          >
          > <svg><text x="100" y="100">
          > <a xlink:href="iframe.html#chicken"
          target="top"><tspan>Chicken</tspan></a>
          > <a xlink:href="iframe.html#artichoke" target="top"><tspan dy="20"
          > target="top">Artichoke</tspan></a>
          > <a xlink:href="iframe.html#frog" target="top"><tspan dy="20"
          > target="top">Frog</tspan></a>
          > </text>
          >
          > </svg>
          >
          >
          > Jim.
        • Jim Ley
          anniea13 wrote in message news:c75jof+iad5@eGroups.com... ... IE does not support #link in the file: protocol, get a webserver
          Message 4 of 18 , May 3, 2004
            "anniea13" <annie@...> wrote in message
            news:c75jof+iad5@......
            > But when I copied your code and created local files, and loded them,
            > the links are not working!!!
            > This is really weird, I don't know what to do!

            IE does not support #link in the file: protocol, get a webserver involved
            even localhost and it will work fine.

            > BTW, why don't you declare the DTD in your SVG?
            > And also the svg and xlink namespaces and all that?
            > Also, tspan is not allowed inside the a element in SVG DTD.

            I was too lazy, it was just a quick example for a list, They should be there
            of course (well not the DTD really) yeah tspan not in A is a big mistake
            fortunately the viewer ignores it, as I said though it was a quicky demo.

            Jim.
          Your message has been successfully submitted and would be delivered to recipients shortly.