7 Replies Latest reply on Feb 6, 2013 7:03 AM by ArtixticA

    Target link to frame is not working

    ArtixticA

      Hi.

      I want to open a page in a specific frame. I do this by placing the name of the frame in the target. But in Firefox and Internet Explorer opens the link in a new window and not in the frame I want. I know is something I'm doing wrong but I can not solve.

       

      This is an example of how it is written:

      window.open("https://www.orbayd.com/pjrest/", "myFrame");   

       

      I also try:  

      window.open("https://www.orbayd.com/pjrest/", target="myFrame");

       

      I will appreciate your help!

        • 1. Re: Target link to frame is not working
          drsqueegee Level 1

          Tim has provided a solution to this here.

           

          What worked for me was to put the following code into "composition ready" on the main stage.

           

          This is a slight edit on the code that Tim provided in the above link...

           

          // function to grab specified param

          sym.getParam = function(name) {

              name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");

              var regexS = "[\\?&]" + name + "=([^&#]*)";

              var regex = new RegExp(regexS);

              var results = regex.exec(window.location.href);

              if (results == null)

          /*If the browser calls the page with no specified time parameter, then it will return the time you put in the quotes below (I have 435 seconds into the timeline, you can put 0 or what ever you want. If a timeparameter is specified in the url then it will start the time line there*/

                 return "435000";

              else

                  return results[1];

          }

           

           

          // get query param called 'param'

          var id = sym.getParam('param');

          console.log(id);

           

           

          // need to use parseInt to change "id" string to number

          // then tell sym to play from that time (I changed this to sym.stop(parselnt(id)); since that is what I wanted it to do

          sym.play( parseInt(id) );

          /*Note: you can also tell the symbol to stop at the time parameter by changing sym.play(parselnt(id)); with sym.stop(parselnt(id));

           

           

           

           

          //endParam

           

          In your above example you would change your code to

          window.open("https://www.orbayd.com/pjrest?param=5000"); Assuming that you wanted the window to play or stop at five seconds into the timeline.

           

          There is a way to specify the parameter with a label too, but I think the code may have to be changed a bit. Tim might help you with that, but this should get you on track for now.

          • 2. Re: Target link to frame is not working
            ArtixticA Level 1

            Hi drsqueegee

            Should I put the name of the frame somewhere in the code?

            • 3. Re: Target link to frame is not working
              drsqueegee Level 1

              The page you want to open at a certain point in the timeline is the page where you place the above code provided by Tim. The original code provided by Tim was posted here....http://forums.adobe.com/message/4715517#4715517

               

              You put the time of the frame you want to go to in the url link that will lead someone to the page with the code. In the example you provided if someone came to the page with the url...https://www.orbayd.com/pjrest/ then the page will play normal, but if they use the url https://www.orbayd.com/pjrest?param=5000 then the page will play from the 5second mark of your timeline.

              • 4. Re: Target link to frame is not working
                drsqueegee Level 1

                Please note that the second last comment in the code should have been closed with a */

                 

                Either remove the comment or close the comment so it will be properly ignored.

                 

                This...

                /*Note: you can also tell the symbol to stop at the time parameter by changing sym.play(parselnt(id)); with sym.stop(parselnt(id));

                 

                Should have read...

                 

                /*Note: you can also tell the symbol to stop at the time parameter by changing sym.play(parselnt(id)); with sym.stop(parselnt(id));*/

                 

                or be removed all together.

                • 5. Re: Target link to frame is not working
                  ArtixticA Level 1

                  drsqueegee: Thank you very much for taking of your time and help me.

                   

                  What I'm trying to make is: that when click on the link, the url appears in an iframe in the same window.

                   

                  In Safari or Chrome works with this: window.open("https://www.orbayd.com/pjrest/", target="myFrame");

                  But in Firefox and Internet Exlorer the url opens in a new window

                  • 6. Re: Target link to frame is not working
                    drsqueegee Level 1

                    Have you tried this?

                     

                    window.open("https://www.orbayd.com/pjrest/", "_self");

                    • 7. Re: Target link to frame is not working
                      ArtixticA Level 1

                      Yes. But ,"_self" works if I have the link within or inside the iframe. The link in my project is outside the iframe. I have to tell the page to load the url in that iframe like a specific target like this:  target="name of the iframe" .