如何从终端运行html文件? [英] How can I run a html file from terminal?

查看:102
本文介绍了如何从终端运行html文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个标题为 test.html 的html文件,这是文件:

I have a html file that titled test.html this is the file:

<!DOCTYPE html>
<html>
<body onload="document.getElementById('saveForm').click();">
<form method="post" enctype="multipart-form-data" name="my_form" onsubmit="clearTextBoxCounter()" action="http://xxxxx" >

  <input type=hidden name=teks value=><center><b>KIRIM SMS GRATIS</b></center><br><br>
Nomer HP:<br />
  <input class="field text small" type="text" maxlength="20" name="Phonenumbers" value="085642383165"/>
  <br />

<br />
Isi Pesan:<br />
  <textarea rows="5" cols="20" onKeyPress=check_length(this.form); onKeyDown=check_length(this.form); name=Text >testing pesan 2</textarea>
<br />

<input id="saveForm" class="btTxt" type="submit" value="KIRIM" name="TOMBOL" />

</body>
</html>

如您所见,

文件加载时会自动单击提交"按钮,并将其重定向到 http://xxxxxx ,我如何从终端运行此html文件?我在安装了网络服务器的openwrt上使用它.

as you can see when the file is loaded it automatically clicks the submit button, and redirects it to http://xxxxxx how can I run this html file from terminal? I'm using this on openwrt with webserver installed on it.

推荐答案

对于那些像我这样的人,他们由于想要从linux终端提供html文件或希望使用terminal命令查看它而到达此线程,请使用这些步骤:-

1)如果要使用浏览器查看html:-
导航到包含html文件的目录
如果您安装了chrome,请使用:-

For those like me, who have reached this thread because they want to serve an html file from linux terminal or want to view it using a terminal command, use these steps:-

1)If you want to view your html using a browser:-
Navigate to the directory containing the html file
If you have chrome installed, Use:-

google-chrome< filename> .html

google-chrome <filename>.html


   &emb;          或
使用:-


                OR
Use:-

firefox< filename> .html

firefox <filename>.html

2)如果要提供html文件并使用浏览器查看
导航到包含html文件的目录
只需在终端上键入以下内容:-

2)If you want to serve html file and view it using a browser
Navigate to the directory containing the html file
And Simply type the following on the Terminal:-

pushd<文件名> .html;python3 -m http.server 9999;弹出;

pushd <filename>.html; python3 -m http.server 9999; popd;


然后点击IP地址0.0.0.0:9999或localhost:9999(执行以上命令后的结果如何).或在终端上输入:-


Then click the I.P. address 0.0.0.0:9999 OR localhost:9999 (Whatever is the result after executing the above commands). Or type on the terminal :-

firefox 0.0.0.0:9999

firefox 0.0.0.0:9999


使用第二种方法,连接到同一网络的其他任何人也可以使用以下URL查看您的文件:-"0.0.0.0:9999"


Using the second method, anyone else connected to the same network can also view your file by using the URL:- "0.0.0.0:9999"

这篇关于如何从终端运行html文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆