Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
hyperPad

hyperPad Forum

  1. Home
  2. General Discussion
  3. JavaScript Project Info Getter: Same Origin Policy Block

JavaScript Project Info Getter: Same Origin Policy Block

Scheduled Pinned Locked Moved General Discussion
helpwebsite
3 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • KamdroidK Offline
    KamdroidK Offline
    Kamdroid
    wrote on last edited by
    #1

    So, I would like to make a script that can retrieve information about my projects through their URL using JavaScript/jQuery, so I can display it on my website.

    However, I cannot figure out how to get around the Same Origin Policy that prevents me from getting the HTML from my project's page so I can parse the information from it.

    Is there any way this could be allowed, or is there a better way that works which I am not aware of?

    Better yet, it would be great to have access to my account's projects, so I could even dynamically load in the projects so there is no manual updating when I release a new project.

    The only solution I am aware of is by using some sort of server-side solution, but unfortunately I may not be able to do this due to the costs.

    $.get('https://www.hyperpad.com/projects/asudb1ye/versions/simple-calculator', function(data) {
      // ...
    });
    

    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.hyperpad.com/projects/asudb1ye/versions/simple-calculator. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

    1 Reply Last reply
    0
    • HamedH Offline
      HamedH Offline
      Hamed
      Admin
      wrote on last edited by
      #2

      @Kamdroid this is a browser security issue. You would need some server side mechanism to do this for you.

      Here is a tool that you can use to circumvent this:

      http://anyorigin.com/

      KamdroidK 1 Reply Last reply
      0
      • HamedH Hamed

        @Kamdroid this is a browser security issue. You would need some server side mechanism to do this for you.

        Here is a tool that you can use to circumvent this:

        http://anyorigin.com/

        KamdroidK Offline
        KamdroidK Offline
        Kamdroid
        wrote on last edited by
        #3

        @hamed Thanks. Yea, I saw some CORS proxies yesterday.

        However, some websites allow CORS which lets the browser get the data.

        I am pretty sure it is done via a header on the server: https://enable-cors.org/server.html

        The proxy works fine, but it would be faster to directly get the hyperPad HTML, and more stable as you don't rely on a third-party to retrieve the HTML.

        For now I'll be using a proxy by default, if the CORS is ever allowed it'd be great.

        I should be releasing my hyperPad info grabber library in a few weeks or so.

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Search