I am trying to send xml via NodeJs. My code is
res.set('Content-Type', 'application/xml');
res.send(body);
But chrome says
Unsafe attempt to load URL http://localhost:3030/my-file.xml from frame with URL http://localhost:3030/my-file.xml. Domains, protocols and ports must match.
How can I fix this?
This doesn't work is due to a security concern that Chrome has blocked XML files from accessing local files in the same directory, while HTML files can access.
Workaround:
On Windows: from the command prompt run
C:\Users\USERNAME\AppData\Local\Google\Chrome\Application\chrome.exe --allow-file-access-from-files
(replacing USERNAME with your username)
On Ubuntu:
for chromium browser type
chromium-browser --allow-file-access-from-files
for google chrome
google-chrome --allow-file-access-from-files
Maybe you have to kill all running windows processes for chrome.exe in the windows task manager.
Related
I need to open a chrome browser (with full screen + localhost:8080) just after login in Debian 8.0 and I am partially able to achieve same with below command-
#!/bin/bash
sensible-browser 127.0.0.1:8080 ---- this opens the browser with the URL
sensible-browser --kiosk 127.0.0.1:8080 ---- this opens the browser in full screen but not with the URL
I am thinking of alternate approach that if I can set browser default page using command then above line can work to open browser in full screen but don't know how to do it.
Please help. Thanks in advance!
This behavior is due to the sensible-browser command. If you look inside the script (probably at /usr/bin/sensible-browser) you may see that this script takes only the first argument.
You can get the expected behavior by running the Chrome executable, usually named google-chrome.
Either google-chrome '127.0.0.1:8000' --kiosk or google-chrome --kiosk '127.0.0.1:8000' will work properly.
Chrome blocks tracking location and therefore my app doesn't work when I runionic serve. I've tried to get around it with the following to no avail.
There were some answers saying to get around it by installing a simple node.js server as chrome will block local files, so I ran:
sudo npm install http-server -g
http-server -o --cors
Then I went to http://localhost:8080/www/index.html which pulled up my app.
Went to chrome settings -> advanced -> content settings -> manage exceptions -> hostname pattern: http://localhost:8080/www/index.html, Behavior: Allow
I made sure to do the ^ so chrome also allowed http://127.0.0.1:8080/www/index.html.
None of this is working, chrome is still blocking geolocation.
Answers I looked at and tried to get to this point: HTML 5 Geo Location Prompt in Chrome, Using node.js as a simple web server, allow to use geolocation for a website for which I previously refused it
I found that firefox doesn't block geolocation the way chrome does and works well with ionic serve.
I'm trying to install and run Selenium on a remote server to run web tests for a Drupal 7 install. I need to find a way for the browsers installed on the server to output their display onto the computer that is connected to the server, and I need to figure out why Selenium is failing to run. Error messages down below.
My server set up:
centOS 7.1 on Linux running NGinX web server
X11Forwarding available and enabled
Drupal 7 install
Selenium 7.x-3.0 Drupal Module
Selenium Standalone Server 2.46.0
Firefox 38.1.0 installed
Google Chrome stable 43.0.2357.132
Chromedriver 2.16 for 64-bit Linux, set to executable, with symlink to driver in /usr/bin and /usr/local/bin (the local is the only necessary one, the usr/bin is just a fallback)
Note: my solution must have the server hosting the selenium server as the website will be delivered to a client when it's ready for production. It won't work for me to just install the selenium server and browsers on my own machine.
My issues:
When I ssh -X user#server, it doesn't seem to matter what I set the DISPLAY to, firefox can't open the display when I run 'firefox &' [e1]. I've tried export DISPLAY=localhost:0.0, localhost:10.0 and [myIP]:0.0/10.0.
When I run the selenium server and attempt to run the sample test cases on my website, the Firefox instance of the test fails to connect through 127.0.0.1 port 7055 [e2] and the Chrome instance is either unable to find the driver or shuts down unexpectedly [e3]
Errors:
e1 - Error: cannot open display: host:#.# <== (Whatever variant I've attempted)
e2 - Message: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: (blank)
e3 - Message: chrome not reachable
SimpleTest isn't a suitable replacement as the things I'm trying to test require too much custom setup to configure a stock Drupal sandbox properly. Consequently, I'm relying on Selenium's option to test on the original site instead of a sandbox.
I'm automating web-UI testing using Selenium. All our existing non-UI related tests are executed through CLI by SSHing into the machine, and it would be great if there's a way to execute these UI tests through CLI by having an X-session run in memory. Is there such a thing in Linux?
There is, its called xfvb.
Sure. You can run a VNC server and have your browser display on that. Like so
noufal#sanitarium% vncserver
Warning: sanitarium:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server sanitarium:1
New 'X' desktop is sanitarium:2
Starting applications specified in /home/noufal/.vnc/xstartup
Log file is /home/noufal/.vnc/sanitarium:2.log
noufal#sanitarium% /usr/bin/env DISPLAY=sanitarium:2 /usr/bin/firefox --ProfileManager --no-remote
Xlib: extension "RANDR" missing on display "sanitarium:2.0".
will run a browser on the VNC
If you want to see it, you can do something like
noufal#sanitarium% vncviewer sanitarium:2
I created a server using Node listening on port 8000, localhost. Verified it's running properly, but I cannot access the WebSocket on the client (Chrome 5). Tried several implementations from various Git repos, node + websocket, socketIO, articles, etc. Nothing.
No port conflicts (sudo lsof -i tcp);
Tried server.listen(8000, "*");
Pointed to ws = new WebSocket("ws://:8000/test");
Debian Lenny, Apache22
Node v0.1.98-31-g1c6671a
I'm thinking there may be a conflict with url rewrite. Or possible permissions. Any ideas?
I had a similar issue on Ubuntu 10.04 LTS 32-bit and Chrome 5.0.375.125 and found out it is a bug in Chrome.
Here's how you can test and work around the problem. I used WebSocket with PHP and later Node.JS:
PHP: Download a tutorial file from http://net.tutsplus.com/tutorials/javascript-ajax/start-using-html5-websockets-today/ and extract it in a folder called 'socket' in your webroot. This folder now contains a readme.txt and the folders 'server' and 'client'. Now start the script in the console according to the readme (for me the command was: sudo php -q /var/www/socket/server/startDaemon.php ). It should print 'Start listening on Socket.' . Leave the console window open. Now go to localhost/socket/client/client.php in Chrome. It should say 'Socket Status 0' and if you look in the console you see no new messages (no connection was made).
Now here comes the trick: open a second Chrome tab. Point this tab to the same url: localhost/socket/client/client.php (It also says 'Socket Status 0'). And then close it again. Your original tab should now say 'Socket Status: 1 (open)' and in the console you see a handshake was made. WebSocket now works.
I repeated the same trick as above but this time using Node.JS with the Socket.IO script. The chat example included in Socket.IO-node ( github.com/LearnBoost/Socket.IO-node ) had the same issue, hanging at the 'Connecting...' stage. Opening a second tab to the chat box and then closing it again solved the problem and the chat box proceeded to load properly. The Node.JS server confirmed the connection in the console. From then on WebSocket worked fine.