Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Not allowed to load local resource",why? #537

Closed
rafaelsalles opened this issue Dec 27, 2015 · 9 comments
Closed

"Not allowed to load local resource",why? #537

rafaelsalles opened this issue Dec 27, 2015 · 9 comments

Comments

@rafaelsalles
Copy link

@rafaelsalles rafaelsalles commented Dec 27, 2015

<html>
<head><title>Test</title></head>
<body>
<script src="https://cdn.jsdelivr.net/webtorrent/latest/webtorrent.min.js"></script>
<script>
var client = new WebTorrent();

var torrentId = 'magnet:?xt=urn:btih:6A9759BFFD5C0AF65319979FB7832189F4F3C35D';

client.add(torrentId, function (torrent) {

    console.log(torrent);

    var file = torrent.files[0];
    file.appendTo('body');
});
</script>

</html>

image

I got a message "Not allowed to load local resource" on Chrome console.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Dec 27, 2015

This is a bug in Chrome. See: https://code.google.com/p/chromium/issues/detail?id=379206

You can workaround it by running a local server and visiting your site over localhost. You can use this npm module to do it:

$ npm install ecstatic -g
$ cd your-project
$ ecstatic
@feross feross closed this Dec 27, 2015
@rafaelsalles

This comment has been minimized.

Copy link
Author

@rafaelsalles rafaelsalles commented Dec 27, 2015

Why video at home page , https://webtorrent.io/ , works fine?

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Dec 27, 2015

Because https://webtorrent.io is not served over file://. If you look in your location bar, you'll see that you are loading the site directly from your filesystem, which Chrome doesn't like.

If you install ecstatic, then it will run a local server for you, so you can visit your site at http://localhost:port so Chrome is happy.

@rafaelsalles

This comment has been minimized.

Copy link
Author

@rafaelsalles rafaelsalles commented Dec 27, 2015

1000x Thanks.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Dec 27, 2015

Cheers!

@webarthur

This comment has been minimized.

Copy link

@webarthur webarthur commented Apr 29, 2016

It is happening on ZeroNet too and I don't know why =(

@webarthur

This comment has been minimized.

@vikrambarnwal

This comment has been minimized.

Copy link

@vikrambarnwal vikrambarnwal commented Jan 25, 2017

Thanks

@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.