Giter Club home page Giter Club logo

Comments (6)

davidlehn avatar davidlehn commented on July 21, 2024

What did you need to know about? Individual .htaccess files can add their own config. And this is in the main apache config:

Header always set Access-Control-Allow-Origin "*"

from w3id.org.

jhaag75 avatar jhaag75 commented on July 21, 2024

Thanks David. I was trying to do a cross domain HTTP Get / Accept request
of some IRIs in the browser, but it wasn't working for any that went
through w3id.org/xapi/ so I'm guessing it would need to be explicitly added
in our .htaccess file as well.

It it possible that it's not working since Access-Control-Allow-Origin "*"
is omitted from our .htaccess? Even if it were provided in the main apache
config? Thanks for your reply.


+1.850.266.7100(office)
+1.850.471.1300 (mobile)
jhaag75 (skype)
http://jasonhaag.com (Web)
http://twitter.com/mobilejson (Twitter)
http://linkedin.com/in/jasonhaag (LinkedIn)

On Tue, Jul 19, 2016 at 2:09 PM, David I. Lehn [email protected]
wrote:

What did you need to know about? Individual .htaccess files can add their
own config. And this is in the main apache config:

Header always set Access-Control-Allow-Origin "*"


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#476 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAiZRtBlKURWUbrESrqk17RHuazLu8UJks5qXSEFgaJpZM4JMyLa
.

from w3id.org.

davidlehn avatar davidlehn commented on July 21, 2024

Perhaps. I haven't had to debug such things myself. Various other .htaccess files set that as well as the associated Access-Control-Allow-Headers. Probably need to experiment and trace HTTP preflight calls and such to see what issues and fixes are.

from w3id.org.

jhaag75 avatar jhaag75 commented on July 21, 2024

I added the following to our .htaccess and it works now. Thanks!

Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Headers "Origin, X-Requested-With,
Accept, Accept-Language"
Header always set Access-Control-Allow-Methods "GET, OPTIONS"


+1.850.266.7100(office)
+1.850.471.1300 (mobile)
jhaag75 (skype)
http://jasonhaag.com (Web)
http://twitter.com/mobilejson (Twitter)
http://linkedin.com/in/jasonhaag (LinkedIn)

On Tue, Jul 19, 2016 at 4:41 PM, David I. Lehn [email protected]
wrote:

Perhaps. I haven't had to debug such things myself. Various other
.htaccess files set that as well as the associated
Access-Control-Allow-Headers. Probably need to experiment and trace HTTP
preflight calls and such to see what issues and fixes are.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#476 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAiZRjJSZ9yZ_xkpZU5N1ItcIw3hN11tks5qXUSRgaJpZM4JMyLa
.

from w3id.org.

jhaag75 avatar jhaag75 commented on July 21, 2024

And here's an example of making a cross domain JavaScript request from a HTML page hosted on another domain in case anyone is ever trying to do something similar. In addition, you need to set the headers and methods. Most of the other htaccess files I found on the w3id.org server only set the origin. When I tested using only the allow origin directive on other servers that alone didn't work for me.

<!doctype html>
<html>
  <head>
    <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
    <script type="text/javascript">
      $(document).ready(function() {
        $.ajax({
          url: 'https://w3id.org/xapi/cmi5',
          type: 'GET',
          dataType: 'json',
          beforeSend: setHeader       
        });
      });
      function setHeader(xhr) {
        xhr.addEventListener('load', function (ev) {console.log(ev);console.log(xhr.response);console.log(xhr.responseText);});
        xhr.setRequestHeader('Accept', 'application/json');
      }
    </script>
  </head>
  <body>
    <h1>Load this page with the browser developer console open and view the network / xhr requests.</h1>
  </body>
</html>

Also posted here: http://xapi.vocab.pub/cmi5-json-test.html

from w3id.org.

davidlehn avatar davidlehn commented on July 21, 2024

For anyone looking, here was the related patch:
#483

from w3id.org.

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.