Fruitsekta.ru

Мир ПК
3 просмотров
Рейтинг статьи
1 звезда2 звезды3 звезды4 звезды5 звезд
Загрузка...

Allow file access from files

Как запустить html с помощью Chrome в режиме» —allow-file-access-from-files»?

У меня такая же ситуация с здесь

и для решения этой проблемы я должен запустить html-файл с помощью Chrome в режиме» —allow-file-access-from-files». Я много раз пытался сделать следующий шаг, но ничего не вышло.

  1. запустите cmd под windows 7
  2. прямой к chrome.папку exe-файла
  3. этого chrome —allow-file-access-from-files file:///C:/test%20-%203.html

7 ответов

найдите путь к исполняемому файлу Chrome, а затем на cmd попробуйте:

EDIT: Как я вижу по вашему вопросу, не забывайте, что Windows немного похожа на Unix, поэтому при вводе «chrome . «, cmd будет искать Chrome в пути, но в целом папка Chrome не находится на пути. Кроме того, вы не указываете расширение для своего исполняемого файла. Поэтому, если вы перейдете в папку Chrome, эта команда наверное, тоже работают:

этот флаг опасен!! оставляет файловую систему открытой для доступа. Документы, происходящие из любого места, локального или веб -, по умолчанию не должны иметь доступа к локальным файлам:/// resources.

гораздо лучшее решение-запустить небольшой http-сервер локально.

— — — — Для Windows — — —

проще всего установить http-сервер глобально, используя диспетчер пакетов узла:

npm install -g http-server

затем просто беги http-server в любом из каталогов проекта:

например. d:my_project> http-server

или, как предложил prusswan, вы также можете установить Python под windows и следовать инструкциям ниже.

— Для Linux —

поскольку Python обычно доступен в большинстве дистрибутивов linux, просто запустите python -m SimpleHTTPServer в каталоге проекта, и вы можете загрузить свою страницу на http://localhost:8000

в Python 3 SimpleHTTPServer модуль слились в http.server , чтобы новая команда python3 -m http.server .

легко, и нет риска безопасности случайно оставить Ваш браузер открытым уязвимым.

на момент написания этой статьи в OS X он обычно будет выглядеть так

если вы урод, как я, и положить ваши приложения в

/Applications , тогда будет

если ни один из них не работает, введите chrome://version В адресной строке Chrome, и он скажет вам, какой вызов «командной строки» вы должны использовать. Просто добавьте —allow-file-access-from-files для этого.

вы можете попробовать веб-сервер для Chrome, который обслуживает веб-страницы из локальной папки с помощью HTTP. Он прост в использовании и избегает флага, который, как упоминалось выше, может сделать вашу файловую систему уязвимой.

не делай этого! вы открываете свою машину для атак. Вместо этого запустите локальный сервер. Это так же просто, как открыть оболочку / терминал / командную строку и ввести

потом, указывая Ваш браузер на

Если вы обнаружите, что это слишком медленно это решение

Если вы используете Mac, вы можете использовать следующую команду терминала:

Quit (force quit) все экземпляры chrome. В противном случае команда ниже не будет работать.

выполнение этой команды в терминале откроет Chrome независимо от того, где он установлен.

How to launch html using Chrome at «—allow-file-access-from-files» mode?

I have the same situation with HERE

And to solve this problem I have to launch html file using Chrome at «—allow-file-access-from-files» mode. I tried next steps many times, but it doesn’t work.

  1. start cmd under windows 7
  2. direct to chrome.exe folder
  3. do this chrome —allow-file-access-from-files file:///C:/test%20-%203.html

Создан 03 сен. 13 2013-09-03 07:53:48 AmyWuGo

You can also use a chrome plugin for that. I find it the most practical way. This is just one example: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en – Robert Parcus 28 май. 15 2015-05-28 15:03:04

@RobertParcus That plugin does not seem to work if you’re using the ‘file’ protocol. – Andrew Thaddeus Martin 17 июн. 15 2015-06-17 15:35:05

7 ответов

Search for the path of your Chrome executable and then, on your cmd, try :

EDIT : As I see on your question, don’t forget that Windows is a little bit similar to Unix, so when you type «chrome . «, cmd will search for Chrome in the PATH, but in general the Chrome folder isn’t on the PATH. Also, you don’t specify an extension for your executable. So if you move to Chrome’s folder, this command will probably work too :

Создан 03 сен. 13 2013-09-03 08:00:00 Mohamed Amine

Amine thank you. But I could get the Chrome launched, just also get the ‘FileError.SECURITY_ERR’. – AmyWuGo 03 сен. 13 2013-09-03 08:11:59

Читать еще:  Как сделать главную форму в access

I go to chrome://version and get this:»Command Line chrome —allow-access-from-files —flag-switches-begin —flag-switches-end» Does this mean I already at the «–allow-file-access-from-files». I am not sure «–allow-file-access-from-files» and «—allow-access-from-files» are the same. – AmyWuGo 03 сен. 13 2013-09-03 08:44:41

I restarted my computer and do the same as you say, and it seems fine. Thank you. – AmyWuGo 03 сен. 13 2013-09-03 09:50:28

Great ! Glad it helped you 🙂 – Mohamed Amine 03 сен. 13 2013-09-03 11:36:45

Restart all instances of Chrome.exe for it to work. – Philippe Lavoie 08 ноя. 13 2013-11-08 12:38:21

As per Philippe’s comment, you need to exit all chrome processes and restart with the command line option. (Windows 7) – yoyo 16 окт. 14 2014-10-16 05:08:24

If it’s not working after restarting Chrome, check running background processes (chrome icon near the clocks). You might have «Let Google Chrome run in the background» option ON. – Alex Klaus 09 фев. 15 2015-02-09 00:15:53

@Amine Stupid question, but just restarting Chromium will turn off the flag right? The ‘allow-file-access-from-files’ isn’t a permanent flag, correct? – Abdul 04 дек. 15 2015-12-04 21:01:50

@Abdul Yes, exactly, unless you create a shortcut with the flag and start Chrome from it. – Mohamed Amine 07 дек. 15 2015-12-07 14:04:36

I wanted to upvote this answer, but I like number 42) Thank you for useful answer! – Evgeniy Kosjakov 22 фев. 17 2017-02-22 11:28:01

Star Chrome from Windows PowerShell: ‘Start-Process «chrome.exe» «—allow-file-access-from-files»‘ – Peppe L-G 09 май. 17 2017-05-09 10:43:40

@PeppeL-G ‘s answer is the easiest solution – TheDarkIn1978 27 июл. 17 2017-07-27 05:56:35

Don’t do this! You’re opening your machine to attacks. Instead run a local server. It’s as easy as opening a shell/terminal/commandline and typing

Then pointing your browser to

If you find it’s too slow consider this solution

Создан 03 фев. 14 2014-02-03 03:37:14 gman

As of this writing, in OS X, it will usually look like this

If you are a freak like me, and put your apps in

/Applications , then it will be

If neither of those are working, then type chrome://version in your Chrome address bar, and it will tell you what «command line» invocation you should be using. Just add —allow-file-access-from-files to that.

Создан 22 авг. 14 2014-08-22 23:17:26 Clay Bridges

That flag is dangerous!! Leaves your file system open for access. Documents originating from anywhere, local or web, should not, by default, have any access to local file:/// resources.

Much better solution is to run a little http server locally.

— For Windows —

The easiest is to install http-server globally using node’s package manager:

npm install -g http-server

Then simply run http-server in any of your project directories:

Eg. d:my_project> http-server

Or as prusswan suggested, you can also install Python under windows, and follow the instructions below.

— For Linux —

Since Python is usually available in most linux distributions, just run python -m SimpleHTTPServer in your project directory, and you can load your page on http://localhost:8000

In Python 3 the SimpleHTTPServer module has been merged into http.server , so the new command is python3 -m http.server .

Easy, and no security risk of accidentally leaving your browser open vulnerable.

Создан 19 ноя. 15 2015-11-19 10:29:20 orszaczky

THIS should be the accepted answer! I came here looking for the right way to use the ‘—allow-file-access-to-files’ command line option with Chrome (and Opera). Your answer lets me know my question is wrong, for an important reason. On top of all that, you’ve written your solution in a concise, easy-to-follow way. Thanks a billion! I would also suggest, @orszaczky, that you write essentially the same answer for the SO question that was linked in this original question, i.e. [this other question](http://stackoverflow.com/q/16487803/5218951). I could write it but you deserve the credit. – Andrew Willems 04 мар. 16 2016-03-04 23:49:57

Читать еще:  Как настроить время слайда в powerpoint

Brilliant answer. Hosting correctly is the most important thing to do – Bobby 23 мар. 16 2016-03-23 20:32:30

This may indeed be a great suggestion, but it is not in fact an answer to the question. The question was not «what is the best way to access local files in chrome» it was specifically «how do I launch with this flag». If you are aware of the risks and don’t open anything you didn’t create, or if you aren’t even online.. it’s perfectly fine. There are reasons why this is useful.. which I would assume is the reason google made it an option. – TinMonkey 17 апр. 16 2016-04-17 03:26:21

Thanks, you save my life! – LucaA 16 май. 16 2016-05-16 22:35:54

It is funny that you would recommend people to install node rather than python on Windows, just for hosting this simple server. As if the python option would be unsuitable for Windows (which it isn’t). **When all you have is a hammer, everything looks like a nail?** – prusswan 06 окт. 16 2016-10-06 13:21:59

@prusswan I use npm under Windows, but never needed to use Python, while most of the Linux distros I know already have Python available by default. Thanks for the tip, I updated the answer. 😉 – orszaczky 06 окт. 16 2016-10-06 19:07:00

How to launch html using Chrome at «—allow-file-access-from-files» mode?

I have the same situation with HERE

And to solve this problem I have to launch html file using Chrome at «—allow-file-access-from-files» mode. I tried next steps many times, but it doesn’t work.

  1. start cmd under windows 7
  2. direct to chrome.exe folder
  3. do this chrome —allow-file-access-from-files file:///C:/test%20-%203.html

Создан 03 сен. 13 2013-09-03 07:53:48 AmyWuGo

You can also use a chrome plugin for that. I find it the most practical way. This is just one example: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en – Robert Parcus 28 май. 15 2015-05-28 15:03:04

@RobertParcus That plugin does not seem to work if you’re using the ‘file’ protocol. – Andrew Thaddeus Martin 17 июн. 15 2015-06-17 15:35:05

7 ответов

Search for the path of your Chrome executable and then, on your cmd, try :

EDIT : As I see on your question, don’t forget that Windows is a little bit similar to Unix, so when you type «chrome . «, cmd will search for Chrome in the PATH, but in general the Chrome folder isn’t on the PATH. Also, you don’t specify an extension for your executable. So if you move to Chrome’s folder, this command will probably work too :

Создан 03 сен. 13 2013-09-03 08:00:00 Mohamed Amine

Amine thank you. But I could get the Chrome launched, just also get the ‘FileError.SECURITY_ERR’. – AmyWuGo 03 сен. 13 2013-09-03 08:11:59

I go to chrome://version and get this:»Command Line chrome —allow-access-from-files —flag-switches-begin —flag-switches-end» Does this mean I already at the «–allow-file-access-from-files». I am not sure «–allow-file-access-from-files» and «—allow-access-from-files» are the same. – AmyWuGo 03 сен. 13 2013-09-03 08:44:41

I restarted my computer and do the same as you say, and it seems fine. Thank you. – AmyWuGo 03 сен. 13 2013-09-03 09:50:28

Great ! Glad it helped you 🙂 – Mohamed Amine 03 сен. 13 2013-09-03 11:36:45

Restart all instances of Chrome.exe for it to work. – Philippe Lavoie 08 ноя. 13 2013-11-08 12:38:21

As per Philippe’s comment, you need to exit all chrome processes and restart with the command line option. (Windows 7) – yoyo 16 окт. 14 2014-10-16 05:08:24

If it’s not working after restarting Chrome, check running background processes (chrome icon near the clocks). You might have «Let Google Chrome run in the background» option ON. – Alex Klaus 09 фев. 15 2015-02-09 00:15:53

@Amine Stupid question, but just restarting Chromium will turn off the flag right? The ‘allow-file-access-from-files’ isn’t a permanent flag, correct? – Abdul 04 дек. 15 2015-12-04 21:01:50

@Abdul Yes, exactly, unless you create a shortcut with the flag and start Chrome from it. – Mohamed Amine 07 дек. 15 2015-12-07 14:04:36

Читать еще:  Создание запроса с параметром в access

I wanted to upvote this answer, but I like number 42) Thank you for useful answer! – Evgeniy Kosjakov 22 фев. 17 2017-02-22 11:28:01

Star Chrome from Windows PowerShell: ‘Start-Process «chrome.exe» «—allow-file-access-from-files»‘ – Peppe L-G 09 май. 17 2017-05-09 10:43:40

@PeppeL-G ‘s answer is the easiest solution – TheDarkIn1978 27 июл. 17 2017-07-27 05:56:35

Don’t do this! You’re opening your machine to attacks. Instead run a local server. It’s as easy as opening a shell/terminal/commandline and typing

Then pointing your browser to

If you find it’s too slow consider this solution

Создан 03 фев. 14 2014-02-03 03:37:14 gman

As of this writing, in OS X, it will usually look like this

If you are a freak like me, and put your apps in

/Applications , then it will be

If neither of those are working, then type chrome://version in your Chrome address bar, and it will tell you what «command line» invocation you should be using. Just add —allow-file-access-from-files to that.

Создан 22 авг. 14 2014-08-22 23:17:26 Clay Bridges

That flag is dangerous!! Leaves your file system open for access. Documents originating from anywhere, local or web, should not, by default, have any access to local file:/// resources.

Much better solution is to run a little http server locally.

— For Windows —

The easiest is to install http-server globally using node’s package manager:

npm install -g http-server

Then simply run http-server in any of your project directories:

Eg. d:my_project> http-server

Or as prusswan suggested, you can also install Python under windows, and follow the instructions below.

— For Linux —

Since Python is usually available in most linux distributions, just run python -m SimpleHTTPServer in your project directory, and you can load your page on http://localhost:8000

In Python 3 the SimpleHTTPServer module has been merged into http.server , so the new command is python3 -m http.server .

Easy, and no security risk of accidentally leaving your browser open vulnerable.

Создан 19 ноя. 15 2015-11-19 10:29:20 orszaczky

THIS should be the accepted answer! I came here looking for the right way to use the ‘—allow-file-access-to-files’ command line option with Chrome (and Opera). Your answer lets me know my question is wrong, for an important reason. On top of all that, you’ve written your solution in a concise, easy-to-follow way. Thanks a billion! I would also suggest, @orszaczky, that you write essentially the same answer for the SO question that was linked in this original question, i.e. [this other question](http://stackoverflow.com/q/16487803/5218951). I could write it but you deserve the credit. – Andrew Willems 04 мар. 16 2016-03-04 23:49:57

Brilliant answer. Hosting correctly is the most important thing to do – Bobby 23 мар. 16 2016-03-23 20:32:30

This may indeed be a great suggestion, but it is not in fact an answer to the question. The question was not «what is the best way to access local files in chrome» it was specifically «how do I launch with this flag». If you are aware of the risks and don’t open anything you didn’t create, or if you aren’t even online.. it’s perfectly fine. There are reasons why this is useful.. which I would assume is the reason google made it an option. – TinMonkey 17 апр. 16 2016-04-17 03:26:21

Thanks, you save my life! – LucaA 16 май. 16 2016-05-16 22:35:54

It is funny that you would recommend people to install node rather than python on Windows, just for hosting this simple server. As if the python option would be unsuitable for Windows (which it isn’t). **When all you have is a hammer, everything looks like a nail?** – prusswan 06 окт. 16 2016-10-06 13:21:59

@prusswan I use npm under Windows, but never needed to use Python, while most of the Linux distros I know already have Python available by default. Thanks for the tip, I updated the answer. 😉 – orszaczky 06 окт. 16 2016-10-06 19:07:00

Ссылка на основную публикацию
Adblock
detector
×
×