HTML study notes 1-What should I do if the HTML written with HBuilderX cannot run on the browser? The problem is here: HBuilderX external web service support configuration

When I first learned HTML, I used HBuilderX development software
and wrote a simple code

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>这是网页的标题</title>
	</head>
	<body>
		<p>这里是网页的内容</p>
	</body>
</html>

But something went wrong,
it couldn’t run in the browser
, it said it couldn’t connect to the server, whether it was Safari browser or firefox browser, it didn’t work

insert image description here

insert image description here
Later, I thought it was necessary to run main in the built-in browser, so I installed the extension of the built-in browser, and then it still didn’t work, and I couldn’t connect
. The server calls the url to the ip of your computer

insert image description here
After I changed it here, it still didn’t work.
Then I asked my master, downloaded the Google Chrome browser, and configured the path.
My master told me that
my HTML has no external container. If there is no external container, visit the local localhost It is useless to
have web services such as apache, ngnix, and tomcat
to directly open html files, which is a file file protocol. If it is http access, web services are required
to access the website, whether it is http:// or https://, the background There is a web service as support, maybe apache or nginx or tomact
to visit xp.cn to download phpstudy software

insert image description here
Then open the apache inside. This apache is used as the external web service support of HBuilderX. After opening the apache, you can use the browser to access the html file I just wrote, but there is still a problem. After accessing, this interface
appears

insert image description here

The reason for this is because of this

insert image description here
The default www website root directory file of phpstudy has not been changed.
The home page is index.html.
The solution is to go to the installation path of phpstudy, delete the file index.html, and then

insert image description here

Put the code file I wrote in this path, and it will be fine.

insert image description here

Then the last thing to do
is to restart HBuilderX, because the file path of HBuilderX has been changed, in the software directory, now I can’t find the code file I just wrote, there is only one file name, I can’t get in, because in the original Some disks cannot be found. After restarting, a new directory will be regenerated in the file directory of HBuilderX, and the code is inside. After that, it can be opened, run, and perfect
no matter whether it is Safari, Firefox, Google Chrome, or the built-in browser.
!

insert image description here

Guess you like

Origin blog.csdn.net/m0_74282485/article/details/128468722