Coder Social home page Coder Social logo

Cross domain? about remotipart HOT 4 CLOSED

nickw avatar nickw commented on August 31, 2024 1
Cross domain?

from remotipart.

Comments (4)

JangoSteve avatar JangoSteve commented on August 31, 2024

Is it just remotipart that's failing, or does the normal jquery-ujs remote request fail as well?

from remotipart.

nickw avatar nickw commented on August 31, 2024

Hmm good question, not sure. The initial errors I noticed in the console were:

Unsafe JavaScript attempt to access frame with URL...Domains, protocols and ports must match.

and

application.js:10244TypeError: 'undefined' is not an object (evaluating 'doc.documentElement')

However on another look, I noticed that the action of the form has a bunch of parameters added to it after hitting submit:

http://uploader-local.APP_DOMAIN.com/users/4e0a01311010dc0001000006/avatars/new?[object Object],[object Object],[object Object]&_=1325710055888

Which is causing a 404. My form looks like this:

simple_form_for(Avatar.new, url: new_user_avatar_url(@user, host: "uploader-local.APP_DOMAIN.com"), remote: true, html: {multipart: true}) do |f|

from remotipart.

JangoSteve avatar JangoSteve commented on August 31, 2024

Hmm, I have no idea why your form has a bunch of stuff appended like that. That error with the iframe is a browser security feature. Probably look into what the correct way is to handle that, as I'm not too sure. A quick workaround off the top of my head would be to host the actual upload form on the uploader-local subdomain.

Other than that, I know I've seen gems which upload files directly to Amazon S3, and the way they usually work is by using flash, which provides access to bypass the cross-domain restrictions.

You also may be able to use the cross-domain.xml directive on the uploader server to allow for cross-domain access, but I'm not sure how that works with iframes.

EDIT: Rereading the error message, that usually happens when you are trying to manipulate the content of an iframe on a different domain from the parent window (which the iframe-transport script that remotipart uses does). Maybe search for this issue on the jquery iframe-transport project.

from remotipart.

nickw avatar nickw commented on August 31, 2024

Ok thanks, I'll go ahead and close this and comment later if I end up solving it

from remotipart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.