Skip to content
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.

Unable to fetch feed , Error Cross-Origin Request Blocked #25

Open
mostafadeveloper opened this issue Apr 27, 2015 · 3 comments
Open

Unable to fetch feed , Error Cross-Origin Request Blocked #25

mostafadeveloper opened this issue Apr 27, 2015 · 3 comments

Comments

@mostafadeveloper
Copy link

Hi
i recently try to use jfeed to get feed and show feed content , but i can't see anythings ... then i use firefox console and see this below error:

" Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://news.google.com/news?pz=1&cf=all&ned=us&hl=en&output=rss. This can be fixed by moving the resource to the same domain or enabling CORS. "

My HTML File--->

<!DOCTYPE HTML>
<html>
<head><title></title>
<meta charset="UTF-8"/>
<script type="text/javascript" src="./jquery.js"></script>
<script type="text/javascript" src="build/dist/jquery.jfeed.pack.js"></script>


</head>
<body>
<div class="panel">
<script type="text/javascript">
jQuery.getFeed({
    //google new rss link
   url     : 'https://news.google.com/news?pz=1&cf=all&ned=us&hl=en&output=rss',
   success : function (feed) {
      console.log(feed.title);
      // do more stuff here
   }
});
</script>
</div>

</body>
</html>
@mostafadeveloper
Copy link
Author

Any Help?

@makc
Copy link

makc commented Aug 7, 2015

maybe use something like https://github.com/softius/php-cross-domain-proxy

@ghost
Copy link

ghost commented Sep 4, 2015

@makc Yes, that's one way, but an even easier way is CrossOrgin.Me, so all you have to do is this:

<!DOCTYPE HTML>
<html>
<head>
    <title></title>
    <meta charset="UTF-8" />
    <script type="text/javascript" src="./jquery.js"></script>
    <script type="text/javascript" src="build/dist/jquery.jfeed.pack.js"></script>
</head>
<body>
    <div class="panel">
        <script type="text/javascript">
            jQuery.getFeed({
                //google new rss link
                url: 'http://crossorigin.me/https://news.google.com/news?pz=1&cf=all&ned=us&hl=en&output=rss',
                success: function(feed) {
                    console.log(feed.title);
                    // do more stuff here
                }
            });
        </script>
    </div>
</body>
</html>

Just add http://crossorigin.me/ before the URL, and you're good to go!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants