Preface Currently, the front-end solves cross-domain problems mainly through the configuration of webpack's devServer. But sometimes devServer is not configured in the development environment, and cross-domain is not set up in the backend. When debugging code locally in a project with separated front-end and back-end, cross-domain issues are often encountered. This article is mainly to supplement the previous article on cross-domain browser access solutions. Because the last setting of this article is about Chrome, the current setting does not work, so I updated the article and corrected it. Solution to the problem that --disable-web-security does not work The previous article provided the setting methods of --disable-web-security for Windows, Mac, Linux, etc., but the new version of Chrome has upgraded its security policy, and this opening method or the previous setting method is invalid. So how to solve it? 1. To set cross-domain, right-click the Chrome shortcut, click 'Properties', 'Shortcut', press the space at the end of the 'Target' path, and then add the following code: --args --disable-web-security --user-data-dir=D:\HaoroomsChromeUserData or --disable-web-security --user-data-dir=D:\HaoroomsChromeUserData D:\HaoroomsChromeUserData is a folder I found randomly. You can configure it at will. If you don’t write it like this, the new version of the browser may have problems with the settings not taking effect. This method is equivalent to the user creating a private Chrome browser on his own computer, and the settings and configurations in it are all private settings. At this time, find the chrome installation source directory and open chrome.exe. You will find that all the bookmarks, options, etc. configured in the private chrome are not in this chrome. Note: If you want to delete D:\HaoroomsChromeUserData, be sure to back up your bookmarks, account passwords, etc. first. Once deleted, it is equivalent to uninstalling the private Chrome in the personal computer, and no data will be retained 2. After the setting is successful, open the browser again and there will be a prompt: "You are using an unsupported command line flag: --disable-web-security, which may reduce stability and security" At this point, normal users can perform cross-domain access, such as local front-end projects, direct connection tests, or online environment interfaces (the premise is that the target environment has been logged in in the current browser and the cookies, session, and other information of the current account already exist) 3. Some users still cannot access the system. In this case, a yellow text will be displayed in the console.
At this time, the browser still restricts cross-domain access to cookies, so some people's computers still cannot use cross-domain. Solution: Enter in the address bar:
Search again:
Find 'SameSite by default cookies' and 'Cookies without SameSite must be secure'. There is a drop-down box behind it. Select 'disabled' for both options. The browser will prompt a red message: 'Warning: You are about to use an experimental feature! ' Choose to ignore the warning. At this time, the browser is the D:\HaoroomsChromeUserData we created locally. Click the Relaunch button in the lower right corner, the browser will automatically restart and keep all currently opened pages. Note: This mode is used for joint debugging. If you visit other shopping websites, it is recommended to use the chrome.exe in the chrome.exe installation source directory to avoid unnecessary trouble. Other systems: Mac is the same as Linux. The original command line does not work. A folder for storing data is also specified to achieve the cross-domain effect. Other solutions A temporary solution can be achieved by using a chrome plug-in. Search for Chrome extensions
After installing the plugin, read their documentation and set the address to be accessed across domains. This is the end of this article about how to set up the new version of Chrome browser to allow cross-domain implementation. For more relevant content about Chrome allowing cross-domain, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future! |
<<: Detailed introduction to linux host name configuration
>>: A simple way to put HTML footer at the bottom of the page
Table of contents Introduction Architecture Advan...
The so-called connection limit in Nginx is actual...
This is a collection of commonly used but easily ...
MySQL bidirectional backup is also called master-...
Because we were going to build a website, in addi...
What is a table? Table is an Html table, a carrie...
Imagine a scenario where, when designing a user t...
1. Introduction When we are writing a page, we so...
Preface To put it simply, tcpdump is a packet ana...
Table of contents Preface Several common bit oper...
Table of contents background Purpose Before split...
As users become more privacy-conscious and take m...
The company's service uses docker, and the di...
An at-rule is a declaration that provides instruc...
Table of contents Introduction Step 1 Step 2: Cre...