How to view html file in remote unix server?
It is possible, but with some playing around on the server.
Once you have ssh'ed into the server, install a web server in that box.
Say the file is named index.html, you should make it available at the URL http://localhost:8000/index.html
or port number can be anything.
The simplest method I can think of starting a web server at that location is
cd /directory/where/html/is/present
python -m SimpleHTTPServer 8000 # For python 2
python3 -m http.server 8000 # For python 3
This works provided python is installed on the server. It should not be that hard to install it as python is available from almost every package manager in every flavor of linux.
Now that html is available at python
http://localhost:8000/index.html
on that machine.
But we have not yet configured the browser in such way.
To do that you need to ssh into the server again, but with a -D option this time
ssh servername -D 7000
-D specifies application level tunneling when connecting via ssh
Then in Firefox, preferences/options -> Advanced -> Networks -> Connection Settings -> Choose Manual Proxy configuration
SOCKS HOST should be localhost , port no 7000.
Then the html should be directly available at
http://localhost:8000/index.html
in your Firefox browser.
This feature is only available in the Firefox browser.
View files on linux remotely from browser
The Linux system that houses text files should have a server installed and firewall set. that serves required text files. Server can be any if you only need serving static files and not need any authentication or business logic. nginx and apache can do the job. and just in response header include
Content-Type: application/pdf
Content-Disposition: inline; filename="filename.pdf"
to force file to be viewed in browser.
Upload file button for remote files
I don't know why; I've had much difficulty with installing anything on the solaris machine. So i've decided to go a slightly different route -- I found out that the machine is already mounted properly, so I can simply switch user accounts to access what I need -- without SSH.
How to open an HTML file in the browser from Python?
Try specifying the "file://" at the start of the URL.
// Also, use the absolute path of the file:
webbrowser.open('file://' + os.path.realpath(filename))
Or
import webbrowser
new = 2 # open in a new tab, if possible
// open a public URL, in this case, the webbrowser docs
url = "http://docs.python.org/library/webbrowser.html"
webbrowser.open(url,new=new)
// open an HTML file on my own (Windows) computer
url = "file://d/testdata.html"
webbrowser.open(url,new=new)
Related Topics
How to Set Filename for Base64 Rendered Pdf Using Object Tag
Angular Material Table - Apply Dynamically Background Color to a Row (Angular 2+)
Fixed Position Relative to Parent Container
How to Force Position Absolute With 100% Width to Fit into Parent Div With Padding
Navbar(Menu) Is Getting Overlapped by Body Element
Angular2, What Is the Correct Way to Disable an Anchor Element
Large File Upload Though HTML Form (More Than 2 Gb)
How to Vertically Align Elements in a Div
Css When Inline-Block Elements Line-Break, Parent Wrapper Does Not Fit New Width
How to Keep Two Side-By-Side Div Elements the Same Height
Setting Attribute Disabled on a Span Element Does Not Prevent Click Events
How to Set Input Field With Current Date in Angular
Angular (Typescript): How to Set Option of Selected to 'Selected' If Two-Way Binded
Angular 4 Img Src Is Not Found
Line Break in HTML Select Option
How to Make the Height of the Div Dynamically Fit the Size of the Div in Which It Is Contained