understanding and/or troubleshooting XMLHttpRequest - No 'Access-Control-Allow-Origin' error - xmlhttprequest

I am not an experienced web developer by any means, so I apologize if this is very basic / newb question. I did try researching this error message, but my skillset lies in different areas, so I was hoping someone could maybe give me a pointer.
We have a SWG (secure web gateway) inline that may or may not be causing this, since access works in IE, but not in Chrome - and the SWG just went inline recently - so am trying to find some root cause for this error.
here is the error message that I pull out of Chrome's Console debugger:
XMLHttpRequest cannot load .... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.youtube.com' is therefore not allowed access. The response had HTTP status code 403.
the "..." shows a URL that referes to a googlevideo.com link, but I am trying to view a video on youtube.com - any video for that matter.
seems that this is an XSS defense mechanism, but I dont see any blocks in the SWG, nor are some of the next-gen features even enabled
Chrome version - Version 51.0.2704.63 m (64-bit)
IE version - 11.0.9600.18314
any help is appreciated.

--disable-web-security now requires the use of the --user-data-dir flag.
Start-up your chrome with below command on windows:
chrome.exe --disable-web-security --user-data-dir
OR
Open Properties window of Google Chrome short cut icon available on desktop.
Go to the Shortcut tab
Specify the following flag at the end of path
"C:...\Application\chrome.exe" --disable-web-security --user-data-dir
Just specifying --disable-web-security --user-data-dir (without a value) worked for me.
If this didn't work for you then try specifying some folder path:
--user-data-dir=$HOME/path/to/some/folder

Related

How to run test in IE browser using OxygenHQ?

I want to run a simple test using OxygenHQ, of opening wikipedia and then search for hello world. The script written is working fine for Chrome and Firefox but in case of IE mutiple windows are opening without the page and then it fails eventually.
Is there any way to fix this? I went through the docs provided at http://docs.oxygenhq.org/guide-web-intro.html but could not get a concrete answer on why this is only happening for IE. Here is a console output and screenshot for reference.
Console Output :
Initializing...
Starting iteration #1
UNKNOWN_ERROR - undefined: args[0].endsWith is not a function at line 1Test finished with status --> FAILED
Details:
Browser: Internet Explorer
Version: 11.535.18362.0
OS: Windows 10
This might be connected to your internet settings
make sure that the IE screen size is 100%
make sure all Internet options in Security Tab (Internet, Local Internet etc') are either with the Enable protected mode on or off (should be the same for all)
see picture
Have a look again at the Oxygen web site, it has had a major facelift and a lot of new content

How to disable "Mark non-secure origins as non-secure" within selenium tests?

I am running non http url inside of my tests (so migration to https wont be easy) and because of that I am getting an warning inside of browser.
How to disable "Non secure" warning inside of Chrome during selenium tests?
I've tried to play with arguments but nothing works
args: [
'start-maximized',
'disable-webgl',
'blacklist-webgl',
'blacklist-accelerated-compositing',
'disable-accelerated-2d-canvas',
'disable-accelerated-compositing',
'disable-accelerated-layers',
'disable-accelerated-plugins',
'disable-accelerated-video',
'disable-accelerated-video-decode',
'disable-gpu',
'disable-infobars',
'test-type',
'disable-extensions',
'allow-running-insecure-content',
'disable-web-security',
'ignore-certificate-errors',
'ignore-gpu-blacklist',
'no-default-browser-check',
'no-first-run',
'disable-default-apps'
]
The issue is that I need to resize windows to 420x800 but because of warning browser can't do that.
"Not Secure" SSL Error
As per Fix “Not Secure” SSL Error on Chrome Browser | Remove Warning with the release of Chrome 68, Google started showing all the HTTP sites as Not Secure on Chrome Browser.
Treatment of HTTP pages
This feature can be turned On / Off by accessing the page at chrome://flags/#enable-mark-http-as and setting the following attribute:
Mark non-secure origins as non-secure: Changes the UI treatment for HTTP pages on Mac, Windows, Linux, Chrome OS, Android
Default
Enabled
Enabled (mark as actively dangerous)
Enabled (mark with a Non Secure warning and dangerous on form edits)
Disabled
Using Selenium to disable this feature you need to use the ChromeOption --allow-running-insecure-content as follows:
Python:
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("start-maximized")
chrome_options.add_argument('disable-infobars')
chrome_options.add_argument('--allow-running-insecure-content')
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe')
driver.get("http://www.legislation.vic.gov.au/")
This does not work for chrome on android devices. It's a bad idea for companies to tell users what and what they can not look at. Tech giants like Google have gone too far and the government is letting it happen.

XMLHttpRequest: Network Error 0x800c0007, No data is available for the requested resource

I have an app that is failing to load in IE. When I look in the console I see
The same code works in IE11 but the code not woking in RDP IE11 couldnot find out exact cause for the issue.
During save it says couldn't download zip document
SCRIPT7002: XMLHttpRequest: Network Error 0x800c0007, No data is
available for the requested resource
Had the same error. It was due to IE not handling deflate properly. Use gzip instead of deflate.

How can I "copy as curl" in Safari?

Is it possible to do "copy as curl" like in Google Chrome and Firefix in Safari? I didn't find anything on google.
Update: Safari 10 seems to support copy as curl. Just right click on domain column and select copy as curl.
I spent quite time trying to debug my webapps in Safari, instead of Chrome, But it seems to be impossible at least for my requirements (ReactDevTools and ReduxDevTools for example.). So I eventually gave up and now I'm using Chrome to debug and Safari to surf. About this particular question I'm pretty sure that there's no way to "copy as curl" a request in Safari.
I know this super old but it is possible to copy cURL requests in safari:
You could use Charles to intercept your requests. This has a 'Copy as cUrl' action in the context menu just like Chrome.

Launching an executable from the web browser via link

I've seen a ton of games and what not opening their applications using links like "game://15.64.15.64:25876" or something.
I want to be able to launch my game's .exe from my website for users who installed it, and for it to work on any browser; At the same time I want to be able to pass a parameter (just 1).
What registry values would need to be added/modified for this to work for all browsers? If there's extra steps to setting it up in all browsers, can you explain these steps? Other questions I've found didn't quite help or worked only in IE. I require Firefox, Chrome, and IE at the least.
A similar question was asked here:
How do I make the website execute links?
You would end up with a structure like this in your registry:
HKEY_CLASSES_ROOT
game
(Default) = "URL:Game Protocol"
URL Protocol = ""
DefaultIcon
(Default) = "game.exe,1"
shell
open
command
(Default) = "C:\Games\YourGame\game.exe" "%1"
See this article on MSDN for details:
Registering an Application to a URI Scheme
As mentioned by OP, the above approach only works in IE. Here are some thoughts on how to make it work in other browsers:
Chrome: Is it possible to open custom URL scheme with Google Chrome?
Firefox: Writing a Firefox Protocol Handler
One way I can think is download a file from browser ( gamesession.gme or your extension)
and set your game as the default application for that extension.