Cross Domain Scripting

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #16
    There's a demo right there.

    Comment

    • dmjpro
      Top Contributor
      • Jan 2007
      • 2476

      #17
      The link is not working here ............... :)

      Comment

      • dmjpro
        Top Contributor
        • Jan 2007
        • 2476

        #18
        I had a look at this link ...
        But i still can't find out to access the cross domain elements what should i do ? :(

        Comment

        • dmjpro
          Top Contributor
          • Jan 2007
          • 2476

          #19
          In my situation what should i be doing ...i am getting messed up .... :)

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #20
            Not sure what happened with the link, but I see you did find it.

            All you have to do is study the code which is linked to from the top (or you can always look at the source).

            Comment

            • dmjpro
              Top Contributor
              • Jan 2007
              • 2476

              #21
              In this link a iframe is there ... which refers to cross domain
              Please check out it's source code ...
              There no buttons has onClick handler then how it fires a code on Click event ?
              Now how it finds out the function body of $ as it's defined in another JS file?

              Please clarify me these queries.. :)

              Comment

              • gits
                Recognized Expert Moderator Expert
                • May 2007
                • 5390

                #22
                the script is included in the page ... just have a look here ... there it is ;)

                kind regards

                Comment

                • dmjpro
                  Top Contributor
                  • Jan 2007
                  • 2476

                  #23
                  Can you help me to do .cross domain scripting ...Did you see my code snippet ?

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #24
                    Which code snippet? I would suggest you take the source code of the example which works and adapt it to your requirements. Of course, it also helps if you read the article to understand how it all works.

                    Comment

                    • dmjpro
                      Top Contributor
                      • Jan 2007
                      • 2476

                      #25
                      If i had no control over the second application then how it would possible to access the elements of second application from first application?
                      Please have a look at the 9th thread .... ;)

                      Comment

                      • acoder
                        Recognized Expert MVP
                        • Nov 2006
                        • 16032

                        #26
                        You said earlier that you did have control (see post #13). If not, one option is the one I suggested earlier (cross-domain proxy). This isn't limited to Ajax. The idea is quite simple and explained in the earlier links.

                        Comment

                        • dmjpro
                          Top Contributor
                          • Jan 2007
                          • 2476

                          #27
                          Today morning i tested out a code which allows me to access the cross domain elements.
                          Have a look at my code .........
                          This is the home page of Domain1.
                          Code:
                          <frameset border="0" rows="50%,*">
                                      <frame name=domain1 id=domain1 src="index.jsp?"/>
                                      <frame name=domain2 id=domain2 src="http://localhost:8084/Domain2/"/>
                                      </frameset>

                          The content of index.jsp which is from Domain1....
                          Code:
                          <head>
                          <script type='text/javascript'>
                                      function callMe(){
                           window.parent.frames['domain2'].document.getElementById('text_box').value = 'Debasis Jana';
                                      }
                                  </script>
                              </head>
                              <body>
                                  <input type=button name=click value="Click Me" onclick="callMe()"/>
                          </body>
                          Now the home page of Domain2 ......
                          Code:
                          <body>
                                  <input type=text name=text_box id=text_box value=""/>
                              </body>
                          Now how it is possible to access the text box[of Domain2] from Domain1?
                          Can anyone help me to figure me out ?

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            #28
                            In addition to the link posted by gits in post #22, take this and adapt it. I suggest the best course of action is to take the two pages from the different domains and try getting it to work at your domains. Once you have it working, it should be trivial to adapt it to your requirements.

                            Comment

                            • dmjpro
                              Top Contributor
                              • Jan 2007
                              • 2476

                              #29
                              Anyway now i understood what is cross domain ...
                              One more good news .... Thanks Acoder ..now i able to manage my things work . The link is very useful to me ... ;)

                              Actually i could not get the location hash but i could set the hash value ..really it was amazing to work with that link .. thanks Acoder.

                              Comment

                              • acoder
                                Recognized Expert MVP
                                • Nov 2006
                                • 16032

                                #30
                                No problem at all. Glad to help.

                                Comment

                                Working...