[英]How to stop live-server opening the browser automatically while coding in Visual Studio Code?
I am trying to build a homepage of a website in Kali Linux. So, I installed VS Code and added an extension " Live Server " written by Ritwick Dey.我正在尝试在 Kali Linux 中构建一个网站的主页。因此,我安装了 VS Code 并添加了一个由 Ritwick Dey 编写的扩展“Live Server”。 I made HTML file, then CSS and now JavaScript. When I was writing HTML and CSS files, everything was normal with Live Server.我制作了 HTML 文件,然后是 CSS,现在是 JavaScript。当我写 HTML 和 CSS 文件时,Live Server 一切正常。 But when i started writing JavaScript file, there happened a glitch.但是当我开始编写 JavaScript 文件时,出现了一个小故障。 Every time, when I take rest after writing some text in alert(" ");
每次,当我在alert(" ");
, the browser automatically opens. , 浏览器自动打开。 I had used only alert("some text");
我只用过alert("some text");
in JavaScript file.在 JavaScript 文件中。 After, I made some changes in file by adding some other statements such as document.getElementById("appname").innerHTML="howdy";
之后,我通过添加一些其他语句对文件进行了一些更改,例如document.getElementById("appname").innerHTML="howdy";
Other statements do not made any disturbance but when I write alert("some_text");
其他语句不会造成任何干扰,但当我写alert("some_text");
, the browser automatically opens. , 浏览器自动打开。
I had enabled Auto Save as "afterDelay" and, while writing this question, I gave "off" value to Auto Save , it stopped automatically opening the browser but when I save the file, it opens the browser.我启用了自动保存为“afterDelay”,并且在写这个问题时,我给自动保存设置了“关闭”值,它停止自动打开浏览器,但是当我保存文件时,它会打开浏览器。
I do not want to let the browser open automatically, when I save the file.当我保存文件时,我不想让浏览器自动打开。 I want to open the browser manually.我想手动打开浏览器。
you can put your alert in a function with javascript, make a timer on onclick button so it works when you want it not when server loads你可以把你的警报放在 function 和 javascript 上,在 onclick 按钮上做一个计时器,这样它就可以在你想要的时候工作,而不是在服务器加载时工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.