@Anywhere cross domain issue


#1

I am writing a web app and want to use the twitter oauth via javascript if at all possible. I am currently trying to use @Anywhere which seems to work but I’ve noticed in Chrome currently when I run the following code:

    twttr.anywhere(function (T) {
        T.signIn();
        T.bind("authComplete", function (e, user) {
          // triggered when auth completed successfully
          console.log("AUTH COMPLETE");
        });
     
        T.bind("signOut", function (e) {
          // triggered when user logs out
        });
      });

As soon as the popup appears if i look at my error console I see that I have a cross domain error: “Unsafe JavaScript attempt to access frame with URL https://api.twitter.com/xd_receiver.html from frame with URL about:blank. Domains, protocols and ports must match.”

I have modified my etc/hosts file so that my local dev is running as a domain and not 127.0.0.1 or localhost. I added the domain to the @Anywhere domain list.

Not sure if this is helpful or not but I am also using jQuery on the same page. Originally I making the call to twitter from inside a jQuery function but have since moved it outside of the jQuery function and still get the same error.

Any help or guidance would be greatly appreciated.


#2

Are you accessing the page on localhost through a webserver or just through file:// URL type? You’ll need to make sure it’s accessed on a web server. What’s the consumer key you’re using?

@Anywhere is showing its age a bit and isn’t being explicitly tested on newer browser versions of mixings with jQuery. You may find the options available in [node:183] more reliable.


#3

#4

#5