Monday, June 1, 2009

[jQuery] Re: accessing dom from different domain ?

$.ajax({
URL : www.myurl.com
success: function(html) {
var my id = $("#myid", html);
alert(myid);
});
});

On Mon, Jun 1, 2009 at 7:51 AM, kaspar <kaspar.ru@gmail.com> wrote:

Ricardo ,
thank you for replay
but I'm getting the same  exception "Permission denied to
get property"

       jq13("#open-oauth-button").click(function(event){
               TwitterService.getAuthUrl(function(url){
                       var myRef = window.open(url,'mywin',
                       'left=20,top=20,width=1000,height=400,toolbar=0,resizable=0');
                       var win=window;
                       jq13(myRef.document).ready(function(){
                               var self = win.jq13(this);
                               self.jq13("div.buttons#deny").click(function(event){

                                       alert("lala");

                               });

                       });


               });
       });


I think the problem is in
jq13(myRef.document). Main window has localhost domain but myRef
window has twitter.com domain so there is cross domain security work .
I'm wondering is the any ability to monitor events in  myRef window?
http://friendfeed.com/ seems made it work but dont know how :)

On Jun 1, 2:50 am, Ricardo <ricardob...@gmail.com> wrote:
> does the document in the other window also have a "jq13" object? If
> not you have to use the one in your main window and pass the other
> window's document as context:
>
> jq13(myRef.document).ready(function(){
>    // grab the document in a jq object
>    var self = this.parentWindow.jq13(this);
>    self.find("div.buttons#deny").click(function(event){
>         alert("lala");
>    });
>
> });
>
> Not tested, might not work but you get the idea.
>
> On May 31, 3:38 pm, kaspar <kaspar...@gmail.com> wrote:
>
> > Hello
> > I'm trying to make Twitter OAuth  and getting "Permission denied to
> > get property"
>
> > here is the code
>
> >         jq13("#open-oauth-button").click(function(event){
> >                 TwitterService.getAuthUrl(function(url){
> >                         var myRef = window.open(url,'mywin',
> >                         'left=20,top=20,width=1000,height=400,toolbar=0,resizable=0');
>
> >                         jq13(myRef.document).ready(function(){
>
> >                                 myRef.jq13("div.buttons#deny").click(function(event){
> >                                         alert("lala");
> >                                 });
>
> >                         });
> >                 });
> >         });
>
> > is it possible to create event listeners on dom from different
> > domain ?

No comments: