Cross-domain AJAX calls in Safari and Chrome - javascript

Firefox and Internet Explorer both have settings where a user may enable forbidden cross-domain calls.
Is there a similar setting or option in Safari and/or Chrome?

Not sure about safari, but Chrome has a command line switch for this:
chrome.exe --disable-web-security
You can view a full list (as of when it was posted!) of command line options for chrome here.

Related

why --disable-web-security doesn't function on chromium-based browsers?

I'm looking to perform cross-domain requests on my localhost in developer mode. I work on Opera. So I used the following command to disable web security since Opera is based on Chromium:
cd c:\Program Files\Opera\
launcher.exe --disable-web-security --user-data-dir="c:\nocorsbrowserdata"
according to this Stack Overflow question. It did open a new instance of Opera for me with the following message:You are using an unsupporting command-line flag: --disable-web-security. Stability and security will suffer to certify that web security has been disabled. But when I try to perform a cross-domain request, I get CORS related errors. So I tried disabling web security on Chrome thinking it was a browser issue using the following command:
chrome.exe --user-data-dir="C:/Chrome dev session" --disable-web-security
It gave me the same message as in Opera but I still didn't get there to perform cross-domain queries. I still don't understand because I was certified on several stackoverflow questions that I could make cross-site requests by disabling web security.

Remote debugging Chrome for iOS

I'm trying to debug an error on Chrome for iPad. How can I do that?
Additional info:
I know how to debug Safari for iOS. I just don't have a Mac at the moment.
Is it true that I need Safari on MacOS X to remote debug Chrome for iOS?
Does Desktop Chrome allow anything?
Is Chrome for iOS just a webview application?
You cannot directly remote debug Chrome on iOS currently. It uses a uiWebView that may act subtly different than Mobile Safari
You have a few options.
Option 1: Remote-debug Mobile Safari using Safari's inspector. If your issue reproduces in Mobile Safari, this is definitely the best way to go. In fact, going through the iOS simulator is even easier.
Option 2: Use Weinre for a slimmed down debugging experience. Weinre doesn't have much features but sometimes it's good enough.
Option 3: Remote debug a proper uiWebView that functions the same.
Here's the best way to do this. You'll need to install XCode.
Go to github.com/paulirish/iOS-WebView-App and "Download Zip" or clone.
Open XCode, open existing project, and choose the project you just downloaded.
Open WebViewAppDelegate.m and change the urlString to be the URL you want to test.
Run the app in the iOS Simulator.
Open Safari, Open the Develop Menu, Choose iOS Simulator and select your webview.
Safari Inspector will now be inspecting your uiWebView.
I've had some success with the iOS remote debug webkit adapter.
Install ios-webkit-debug-proxy and libimobiledevice
npm install remotedebug-ios-webkit-adapter -g
Enable remote debugging in Safari - iOS Settings => Safari preferences => enable "Web Inspector"
Make your computer trust your iOS device- starting iTunes could prompt the "Trust this computer" dialog.
remotedebug_ios_webkit_adapter --port=9000
Open tabs should show up in chrome://inspect/#devices
If you're just looking for the console logs, there's chrome://inspect, which will display console.log of other tabs in iOS Chrome.
The Firefox Tools Adaptor allows one to use Firefox DevTools to debug websites on Safari or Google Chrome for iOS or Android.
https://github.com/mozilla/valence#debugging-safari-firefox-and-other-webviews-on-ios
Is it true that I need Safari on MacOS X to remote debug Chrome for iOS?
As far as I understand, yes.
Does Desktop Chrome allow anything?
No
Is Chrome for iOS just a webview application?
Yes, the app would be rejected otherwise, this is why Mozilla originally did not build a browser for iOS.

enable cookie.js in Chrome

I use jquery.cookie.js plugin for my application (within server, only html5)
the follow code works for IE9 an firefox but not for Chrome :
$.cookie('the_cookie', 'the_value');
If I run Chrome with option --enable-file-cookies it's OK and my Chrome browser support cookies
My question : Is it any way to enable this option with javascript not by terminal?
chrome has problems if you test that on 'localhost'. Use 127.0.0.1 instead
No it is security related approach in Google Chrome. It should be a bug in Chrome if you are able to enable something the client disabled it.

Why does IE 8 navigator.userAgent return MSIE 7.0?

I am trying to implement a browser support feature on my webpage. For Firefox 3.6 it is working fine, but for some reason IE 8's userAgent is returning a wrong value.
Here is the scenario, when I run a 'local' javascript code on IE8, navigator.userAgent returns correct information (MSIE 8.0). But when I run this script on a server, it returns MSIE 7.0 on an IE 8 browser.
Any ideas?
You need to check Trident token too.
Trident token
When the F12 developer tools are used to change the browser mode of Internet Explorer, the version token of the user-agent string is modified to appear so that the browser appears to be an earlier version. This is done to allow browser specific content to be served to Internet Explorer and is usually necessary only when websites have not been updated to reflect current versions of the browser.
When this happens, a Trident token is added to the user-agent string. This token includes a version number that enables you to identify the version of the browser, regardless of the current browser mode.
MORE : http://msdn.microsoft.com/en-us/library/ms537503.aspx
Are you sure you aren't running in IE7 mode? You can change it somewhere in the Developer settings (F12, I think).
Microsoft provides this page:
http://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx
According to the Javascript sample one would think IE8 would return an 8, not a 7.

Crossdomain settings in Google Chrome

I'm wondering, in IE & Firefox you're able to setup the browser, to allow
cross-domain calls.
I can't find any option in chrome for that (actually, there are in general not too much options at all...)
are there any about:config like things?
Kind Regards
--Andy
This answer was correct when written, but is longer correct, the switch has been deprecated
Chrome has a command line switch for this:
chrome.exe --disable-web-security
You can view a full list (as of when it was posted!) of command line options for chrome here.
No. Sorry.
Chrome and Firefox, however do support cross-domain requests via the W3C CORS spec (Cross Origin resource sharing) however the remote host has to enable it. If the remote host supports it explicitly then you don't have to make any changes to your XMLHttpRequest to be able to fetch the content.
You can install chrome plugins which enable cross-origin resource sharing .
I use this .

Categories