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

IE+ASV and "Open in New Window": possible solution

Expand Messages
  • Helder Magalhães
    @Bruce [A] ... Yes, but only through serious hacking! ;-) Some try-and-error trial first: 1. Using xlink:show [1] - has no effect (opens in same window).
    Message 1 of 6 , Mar 25, 2008
    View Source
    • 0 Attachment
      @Bruce [A]
      > Any ideas?

      Yes, but only through serious hacking! ;-)



      Some try-and-error trial first:
      1. Using "xlink:show" [1] - has no effect (opens in same window). Code snippet:
      <a xlink:href="http://www.svg.org/" xlink:show="new"><text x="800"
      y="700">SVG</text></a>

      2. Using target [2] - link is disabled (not even a warning is
      displayed!) in IE7 and IE8 beta1. Apparently works in IE6, though...
      Code snippet:
      <a xlink:href="http://www.svg.org/" target="_blank"><text x="800"
      y="700">SVG</text></a>

      3. Using tricky script - ASV3 compatible - a permission denied
      exception is thrown. Code snippet:
      <a xlink:href="http://www.svg.org/"
      onclick="window.open(evt.target.parentNode.getAttribute('xlink:href'))"><text
      x="800" y="700">SVG</text></a>

      4. Using HTML to do the trick - only works if one is using an HTML
      loader, though ASV open the link in same window also. Code snippet:
      <a xlink:href="http://www.svg.org/"
      onclick="window.top.open(evt.target.parentNode.getAttribute('xlink:href'))"><text
      x="800" y="700">SVG</text></a>

      5. Trying to avoid link action by using "return" according to
      window.open result - again, only works when using an HTML loader.
      Using "return" issues an error in ASV3 and has no effect in ASV6 -
      link is opened in same window also... Code snippet:
      <a xlink:href="http://www.svg.org/"
      onclick="return(!window.top.open(evt.target.parentNode.getAttribute('xlink:href')))"><text
      x="800" y="700">SVG</text></a>



      Towards a solution:
      Using the HTML loader allows us to use HTML environment to open links
      which are meant for new windows. It also helps avoiding some security
      issues with IE7+ [C] (but that should be left to another post to avoid
      mixup).

      The final result achieved can be seen in attached files
      ("IEplusASV.zip" contains all files which are also attached
      separately). Comments and potential issues are welcome!

      Known issue: for links which are processed by script, ASV's context
      menu no more reflects links ("Open"/"Open in New Window") as they are
      effectively removed during the process.



      @Jonathan Chetwynd [A]
      > However accessibility guidance is that opening a new window should be
      > under the users discretion.
      > Not the authors...
      > One reason being that for blind users it is confusing and more
      > difficult to navigate iirc.

      Yes, I have no good answer for this. I believe this can be somehow
      improved using the "cursor" property [2]. The attached sample makes
      use of this idea. Note that custom cursors only work in Firefox
      (tested in version 2) and Safari (tested in version 3.0 beta).
      Nevertheless, this does not address the blind user question... :-|



      @svgquestion [B]
      > If I click on a hyperlink, my application cgashes down ?

      I've found out that ASV6 easily crashes when doing direct SVG
      navigation (using hyperlinks which are SVG files). The crashes usually
      increase if several SVG instances are used (multiple windows). Using
      the HTML loader helps a lot, although crashes still occur sometimes.
      ASV3 doesn't seem to suffer from this (at least, not under the same
      conditions). As stated (in "Towards a solution"), this is a good
      subject for another post... :-)



      Hope this helps,

      Helder Magalhães



      [A] http://tech.groups.yahoo.com/group/svg-developers/message/60129
      [B] http://tech.groups.yahoo.com/group/svg-developers/message/60130
      [C] http://tech.groups.yahoo.com/group/svg-developers/message/60089

      [1] http://www.w3.org/TR/SVG/linking.html#AElementXLinkShowAttribute
      [2] http://www.w3.org/TR/SVG/linking.html#AElementTargetAttribute
      [3] http://www.w3.org/TR/SVG/interact.html#CursorProperty


      [Non-text portions of this message have been removed]
    • Helder Magalhães
      ... Thanks a lot, Yahoo! :-D http://tech.groups.yahoo.com/group/svg-developers/files/IE%20plus%20ASV/ Regards, Helder Magalhães
      Message 2 of 6 , Mar 25, 2008
      View Source
      • 0 Attachment
        > [Non-text portions of this message have been removed]
        Thanks a lot, Yahoo! :-D

        http://tech.groups.yahoo.com/group/svg-developers/files/IE%20plus%20ASV/

        Regards,

        Helder Magalhães
      • svgquestion
        Dear Helder, Thank you very much for your solution how to open a new window with IE7 and ASV !!!!!!! It solved my probleme. But I do not understand why you
        Message 3 of 6 , Mar 26, 2008
        View Source
        • 0 Attachment
          Dear Helder,

          Thank you very much for your solution how to open a new window with
          IE7 and ASV !!!!!!! It solved my probleme.

          But I do not understand why you included the html loader ? I'm using
          your approach without the html loader.

          Thanks a lot




          --- In svg-developers@yahoogroups.com, Helder Magalh㥳
          <helder.magalhaes@...> wrote:
          >
          > > [Non-text portions of this message have been removed]
          > Thanks a lot, Yahoo! :-D
          >
          > http://tech.groups.yahoo.com/group/svg-developers/files/IE%20plus%
          20ASV/
          >
          > Regards,
          >
          > Helder Magalh㥳
          >
        • brucerindahl
          Helder Nice work! I never got this to work directly - Thanks for the tips. What I did get working is something similar. I need to create a table based on user
          Message 4 of 6 , Mar 26, 2008
          View Source
          • 0 Attachment
            Helder
            Nice work!
            I never got this to work directly - Thanks for the tips.

            What I did get working is something similar. I need to create a table
            based on user input in the SVG display. That table had to be opened
            in a new window with links to a new domain. This is how I got it
            working.

            First in the SVG document I have something like this:

            <a id="myTableLink"><text>My Table</text></a>

            I don't need the xlink:href attribute yet - it will be created later.
            Then the user manipulates the DOM by digitizing an area on the
            screen. The request is "What wells are located in this area?"
            A function takes the digitized area and sends it to a php script via
            XMLHTTPRequest that gets a list of wells and the required attributes
            and generates an HTML file on the server. Finally the php script
            returns the filename to the SVG document in the format <g
            id="myNewTable.html" />. The javascript function that is called with
            this input is then:

            function wellWindow(wellTable)
            {
            if (window.getURL) {
            wellTable = parseXML(wellTable.content,document).firstChild;
            }
            var anchor = document.getElementById("wellTableLink");

            var fileName = wellTable.getAttributeNS(null,"id");
            anchor.setAttributeNS(xlinkNS,"xlink:href","javascript:var x =
            window.open('" + fileName +
            "','name','height=400,width=500,scrollbars=yes');");
            }

            The first if statement is for IE+ASV (Note this will NOT work for
            ASV6!). Then the xlink:href is added (or changed) to a javascript
            function that opens a new small window. The file name MUST be on the
            local domain, otherwise the security error will fire in IE. However
            the HTML file that is opened in the new window can have links to any
            domain.

            Let me know if this helps or you need more details.

            Bruce


            --- In svg-developers@yahoogroups.com, "Helder Magalhães"
            <helder.magalhaes@...> wrote:
            >
            > @Bruce [A]
            > > Any ideas?
            >
            > Yes, but only through serious hacking! ;-)
            >
            >
            >
            > Some try-and-error trial first:
            > 1. Using "xlink:show" [1] - has no effect (opens in same window).
            Code snippet:
            > <a xlink:href="http://www.svg.org/" xlink:show="new"><text x="800"
            > y="700">SVG</text></a>
            >
            > 2. Using target [2] - link is disabled (not even a warning is
            > displayed!) in IE7 and IE8 beta1. Apparently works in IE6, though...
            > Code snippet:
            > <a xlink:href="http://www.svg.org/" target="_blank"><text x="800"
            > y="700">SVG</text></a>
            >
            > 3. Using tricky script - ASV3 compatible - a permission denied
            > exception is thrown. Code snippet:
            > <a xlink:href="http://www.svg.org/"
            >
            onclick="window.open(evt.target.parentNode.getAttribute('xlink:href'))"><text
            > x="800" y="700">SVG</text></a>
            >
            > 4. Using HTML to do the trick - only works if one is using an HTML
            > loader, though ASV open the link in same window also. Code snippet:
            > <a xlink:href="http://www.svg.org/"
            >
            onclick="window.top.open(evt.target.parentNode.getAttribute('xlink:href'))"><text
            > x="800" y="700">SVG</text></a>
            >
            > 5. Trying to avoid link action by using "return" according to
            > window.open result - again, only works when using an HTML loader.
            > Using "return" issues an error in ASV3 and has no effect in ASV6 -
            > link is opened in same window also... Code snippet:
            > <a xlink:href="http://www.svg.org/"
            >
            onclick="return(!window.top.open(evt.target.parentNode.getAttribute('xlink:href')))"><text
            > x="800" y="700">SVG</text></a>
            >
            >
            >
            > Towards a solution:
            > Using the HTML loader allows us to use HTML environment to open links
            > which are meant for new windows. It also helps avoiding some security
            > issues with IE7+ [C] (but that should be left to another post to avoid
            > mixup).
            >
            > The final result achieved can be seen in attached files
            > ("IEplusASV.zip" contains all files which are also attached
            > separately). Comments and potential issues are welcome!
            >
            > Known issue: for links which are processed by script, ASV's context
            > menu no more reflects links ("Open"/"Open in New Window") as they are
            > effectively removed during the process.
            >
            >
            >
            > @Jonathan Chetwynd [A]
            > > However accessibility guidance is that opening a new window should be
            > > under the users discretion.
            > > Not the authors...
            > > One reason being that for blind users it is confusing and more
            > > difficult to navigate iirc.
            >
            > Yes, I have no good answer for this. I believe this can be somehow
            > improved using the "cursor" property [2]. The attached sample makes
            > use of this idea. Note that custom cursors only work in Firefox
            > (tested in version 2) and Safari (tested in version 3.0 beta).
            > Nevertheless, this does not address the blind user question... :-|
            >
            >
            >
            > @svgquestion [B]
            > > If I click on a hyperlink, my application cgashes down ?
            >
            > I've found out that ASV6 easily crashes when doing direct SVG
            > navigation (using hyperlinks which are SVG files). The crashes usually
            > increase if several SVG instances are used (multiple windows). Using
            > the HTML loader helps a lot, although crashes still occur sometimes.
            > ASV3 doesn't seem to suffer from this (at least, not under the same
            > conditions). As stated (in "Towards a solution"), this is a good
            > subject for another post... :-)
            >
            >
            >
            > Hope this helps,
            >
            > Helder Magalhães
            >
            >
            >
            > [A] http://tech.groups.yahoo.com/group/svg-developers/message/60129
            > [B] http://tech.groups.yahoo.com/group/svg-developers/message/60130
            > [C] http://tech.groups.yahoo.com/group/svg-developers/message/60089
            >
            > [1] http://www.w3.org/TR/SVG/linking.html#AElementXLinkShowAttribute
            > [2] http://www.w3.org/TR/SVG/linking.html#AElementTargetAttribute
            > [3] http://www.w3.org/TR/SVG/interact.html#CursorProperty
            >
            >
            > [Non-text portions of this message have been removed]
            >
          • Helder Magalhães
            ... I m glad to know that it helped! :-) ... The HTML loader is used because: 1) if you load a SVG file directly into the browser (not using embed nor
            Message 5 of 6 , Mar 27, 2008
            View Source
            • 0 Attachment
              > Thank you very much for your solution how to open a new window with
              > IE7 and ASV !!!!!!! It solved my probleme.
              I'm glad to know that it helped! :-)

              > But I do not understand why you included the html loader ? I'm using
              > your approach without the html loader.
              The HTML loader is used because:
              1) if you load a SVG file directly into the browser (not using
              'embed' nor 'object') and attempt to perform a "window.open", ASV
              complains with a security error. At least, I tried it in step 3 of
              failed attempts [1]. Maybe the security is shown only if you try to
              open a window for a non-HTML resource (navigation between SVG files,
              for example).
              2) ASV6 sometimes crashes when you have several SVG resources
              simultaneously shown and open an SVG file directly. Using an HTML
              loader seems to help avoiding this. More about this in a separate post.

              Regards,

              Helder Magalhães

              [1] http://tech.groups.yahoo.com/group/svg-developers/message/60185
            • svgquestion
              Hi Helder, thank you very much for this. In my case your javascript function works very good in IE7+ASV3.03 without the loader if I open an html page of
              Message 6 of 6 , Mar 27, 2008
              View Source
              • 0 Attachment
                Hi Helder,

                thank you very much for this. In my case your javascript function
                works very good in IE7+ASV3.03 without the loader if I open an html
                page of another domain from my svg page.

                But at the end your loader solved another probleme. I think it is
                really necessary to verify if the user who tries to open the svg
                page with IE has the ASV viewer installed. I think your solution is
                very good. I will integrate it into my projet.

                I still remember an older discussion where different members argued
                that it is not possible to create a function like your loader. From
                my point of view your loader is very good.

                Thanks again

                --- In svg-developers@yahoogroups.com, Helder Magalhães
                <helder.magalhaes@...> wrote:
                >
                > > Thank you very much for your solution how to open a new window
                with
                > > IE7 and ASV !!!!!!! It solved my probleme.
                > I'm glad to know that it helped! :-)
                >
                > > But I do not understand why you included the html loader ? I'm
                using
                > > your approach without the html loader.
                > The HTML loader is used because:
                > 1) if you load a SVG file directly into the browser (not using
                > 'embed' nor 'object') and attempt to perform a "window.open", ASV
                > complains with a security error. At least, I tried it in step 3 of
                > failed attempts [1]. Maybe the security is shown only if you try to
                > open a window for a non-HTML resource (navigation between SVG
                files,
                > for example).
                > 2) ASV6 sometimes crashes when you have several SVG resources
                > simultaneously shown and open an SVG file directly. Using an HTML
                > loader seems to help avoiding this. More about this in a separate
                post.
                >
                > Regards,
                >
                > Helder Magalhães
                >
                > [1] http://tech.groups.yahoo.com/group/svg-developers/message/60185
                >
              Your message has been successfully submitted and would be delivered to recipients shortly.