Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cross-Origin Request Blocked

25 views
Skip to first unread message

emf

unread,
Jul 19, 2022, 5:47:00 PM7/19/22
to
Hi.

I have on my computer a program that reads a local text file. It
used to work OK but now it doesn't and the Web Developer Tools
of Firefox says:

Cross-Origin Request Blocked: The Same Origin Policy disallows
reading the remote resource at file:///C:/...

Is there any work-around?

Thanks,

Eustace
--
It ain't THAT, babe! — A radical reinterpretation
https://emf.neocities.org/bd/itaintmebabe.html

Arno Welzel

unread,
Jul 19, 2022, 7:34:55 PM7/19/22
to
emf:

> Hi.
>
> I have on my computer a program that reads a local text file. It
> used to work OK but now it doesn't and the Web Developer Tools
> of Firefox says:
>
> Cross-Origin Request Blocked: The Same Origin Policy disallows
> reading the remote resource at file:///C:/...
>
> Is there any work-around?

No.

Accessing local files is restricted for security reasons.

Also see:
<https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSRequestNotHttp>

--
Arno Welzel
https://arnowelzel.de

The Natural Philosopher

unread,
Jul 20, 2022, 7:18:44 AM7/20/22
to
On 20/07/2022 00:34, Arno Welzel wrote:
> emf:
>
>> Hi.
>>
>> I have on my computer a program that reads a local text file. It
>> used to work OK but now it doesn't and the Web Developer Tools
>> of Firefox says:
>>
>> Cross-Origin Request Blocked: The Same Origin Policy disallows
>> reading the remote resource at file:///C:/...
>>
>> Is there any work-around?
>
> No.
>
I wouldn't be as categorically sure as all that.
I can think of at least one way.

Construct a minimal web server on the local machine and access it via ajax.

Or find some mechanism where JavaScript or the browser interacts with
the host, and subvert it...



> Accessing local files is restricted for security reasons.
>
> Also see:
> <https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSRequestNotHttp>
>


--
Ideas are more powerful than guns. We would not let our enemies have
guns, why should we let them have ideas?

Josef Stalin

Arno Welzel

unread,
Jul 21, 2022, 5:19:06 AM7/21/22
to
The Natural Philosopher:

> On 20/07/2022 00:34, Arno Welzel wrote:
>> emf:
>>
>>> Hi.
>>>
>>> I have on my computer a program that reads a local text file. It
>>> used to work OK but now it doesn't and the Web Developer Tools
>>> of Firefox says:
>>>
>>> Cross-Origin Request Blocked: The Same Origin Policy disallows
>>> reading the remote resource at file:///C:/...
>>>
>>> Is there any work-around?
>>
>> No.
>>
> I wouldn't be as categorically sure as all that.
> I can think of at least one way.
>
> Construct a minimal web server on the local machine and access it via ajax.

For this you need Node.js:

<https://nodejs.org/api/http.html#http_http_createserver_options_requestlistener>

Or setup Apache2 or Nginx.

I'm not sure if I'd call this a "workaround". To me this seems to be a
completely different approach - don't access locally but using a webserver.

The Natural Philosopher

unread,
Jul 21, 2022, 6:25:00 AM7/21/22
to
Well yes, semantics is one thing, bits in silicon is another.

--
A lie can travel halfway around the world while the truth is putting on
its shoes.

Ezimene nimi Teine nimi

unread,
Mar 6, 2023, 6:27:20 AM3/6/23
to
Get to: http://aaaaaaaaaaaaaaaar.medianewsonline.com/firstpage.php

And invite all Your friends too !!!!!!!!!!!
0 new messages