I'm working on a Chrome/Firefox extension which will be using the file API to store files locally. I'm trying to get an example up and running but I'm running into issues which seem to center around Chrome. Can anyone explain why this jsFiddle works fine, but the exact same code, when run from a local file, doesn't work. Please note that it works fine in Firefox, just not in Chrome. Any ideas?
Chrome has unusually restrictive web security; many things, like Ajax, won't work when run locally. This is one of them. You can get around this problem by either using a local websever, like #ephemient suggests, or you can run Chrome in unsafe mode for testing:
chrome.exe --disable-web-security
Yep. Chrome's SOP prevents just about everything in file:// from working[1]. Use a local webserver instead.
If you are using chrome. Start the chrome from command line with the flag
--allow-file-access-from-files
chrome doesn't support for accessing local file without this flag.
Related
I am using http-server with ssl certificate in order to test facebook instant games. However, while server is running localhost makes my browser download index.html file instead of actually serving it in a browser. The problem occures in chrome, but microsoft edge seems to be fine.
Use this URL http://127.0.0.1:8080/
instead of localhost:8080
I found out this problem only occurs in Chrome, edge seemed to work fine, so I decided to clear browsing data in the chrome settings and tried again and surprisingly it doesn't download index.html from localhost:8080 anymore! This method solved my issue.
I set up apache2 for training myself to write php and javascript files.
It functioned fine for a while.
Then the browser (Firefox) started asking me whether I wanted to open or download the files I was working on.
Even if I say "open", it first saves a copy of the file in
file:///tmp/mozilla_name0/index.html
and then it renders it in a new window.
I open the file with
http://localhost/index.html
I tried replacing localhost with 127.0.0.1
-> no effect
I tried "sudo chmod 000 mozilla_name0
-> it started using mozilla_name1 instead
I looked in about:preferences / Application but there is no option to tell Firefox what to do with html files. Probably because it should know!
I looked in about:config but I didn't see what I should change in there.
I looked online but I couldn't find this issue. I even searched in bugzilla.org
I don't know if this an apache issue, or what.
I don't think this is a browser issue because I installed opera, tried to make it execute my html file and it downloaded it instead.
Please help.
I'm trying to decrypt SSL packages with Wireshark as described here. I have already created a SSLKEYLOGFILE System and User variable and the log file. I have restarted my computer (running Windows 10), and opened https urls with Chrome and Firefox, but none write to the ssl log file. My Chrome version is 56.0.2924.87 (64-bit) and my Firefox version is 51.0.1 (32-bit). Any idea how can I make any of the two browsers write to that file? Or is there any way to get the SSL key to be able to decrypt SSL packages in Wireshark?
You are doing something wrong. Tested on version 58 & you do not need to reboot. To activate either:
set environment variable e.g. SSLKEYLOGFILE to %USERPROFILE%\sslkeysENV.pms
run chrome with argument e.g.:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --ssl-key-log-file=%USERPROFILE%\sslkeysARG.pms
With Firefox the features seems to be disabled by default and is only available in debug builds. With Chrome this might have been vanished by switching the underlying SSL engine from NSS (which implemented this feature and is also used in Firefox) to BoringSSL (which maybe does not have this feature).
Update: according to #Lekensteyn (see comment) the feature is again available in current Firefox and Chrome builds.
I have solved it!
You MUST be sure chrome totally be closed. And then reopen a fresh new chrome instance.
Chrome has a default options let chrome run in background enabled.
Double check your taskbar of windows or processes lists to make sure there's no chrome instance exists.
That's why --ssl-key-log-file don't working, chrome stills alive after you click exit button.
Try Firefox Developer edition, the above mentioned feature is turned on by default. I tested yesterday only.
Some antiviruses (like Avast) inject the SSLKEYLOGFILE environment variable into well-known processes like firefox.exe and chrome.exe. If you rename the browser executable file and launch that, then the environment variable won't be overridden.
Try to close your current browsing session, it behave like you just add a new path to PATH, only work from the new session and so on.
Besides what they have already pointed out, I want to show three points that may help. These are tips for Linux (CentOS)
Make sure the file that related to SSLKEYLOGFILE can be written and read, to make sure you can use:
chmod -R 777 sslkey.txt
Make sure your Firefox or Chrome is opened under the same user with the file mentioned, for example under root.
Find some useful comments here
When i run my index.html from chrome browser everything works fine but after i created a chrome app from the same files and tried to run the app i get "window.openDatabase is not a function" error.Did i miss something? I've heard that WEBsql is being depreciated but if that's the problem then why is it working on my browser?The only change i made to the folder with my html/js/css files in order to create the chrome app was adding a manifest and a background.js,i also changed window.localstorage with chrome.storage.local
Chrome has refused to support it in apps.
Given that WebSQL is deprecated, it's extremely unlikely that we'd expose the API in new contexts.
It has been noted that you can workaround by using it inside a webview. Here is the relevant issue.
I am trying to debug some Javascript locally, but I'm running in to a strange issue. If I open a local file like:
<html>
<head>
<script src="file.js"></script>
</head>
<body></body>
</html>
with a file.js that is just:
(function() {
'use strict';
debugger
})();
it fails to pause on the debugging line. However, if I open that exact same file in Firefox/Firebug, it does pause on that line. Also, if I add debugger lines to files served on my local server (ie. http:// files instead of file:// files) the Chrome debugger pauses as expected.
The problem only manifests (as far as I can tell) in Chrome with local files. However, I've googled a lot and I haven't been able to find any sort of "disable debugger in local files" option for Chrome or anything like that (that I might have accidentally enabled).
Has anyone ever seen this before, and if so were you able to resolve it?
So it turned out that the problem was a flag I had added to Chrome. By default Chrome won't let your local files access other local files, so I had enabled local-file-loading with the command line flag:
--allow-file-access-from-files
That worked great, except it caused a side effect I didn't realize: when you run local files (or at least local files loaded by other local files) Chrome apparently "sandboxes" them. Unfortunately, Chrome also refuses to debug "sandboxed" code, which meant that my debugger was mysteriously failing.
So, for anyone who wants to run local files in Chrome (say to run a web-based testing framework), the trick is to first add the above flag, but then also add this flag:
--allow-sandbox-debugging
so that Chrome will still trigger the debugger when your code includes a debugger line in a local file.