LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-18-2024, 09:11 PM   #1
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416
Blog Entries: 43

Rep: Reputation: 36
JavaScript GUI For shelp.sh - Reading a File in JavaScript, Displayed on Linux Client


Here is my code:

Code:
<HTML>
<HEAD>
<TITLE>Help Displayer</TITLE>
<SCRIPT LANGUAGE="javaScript">
<!-- Hide javascript
function help(topic, subtopic)
{
 const path = "/etc/settings/shelp/"
 const fr = new FileReader(path + topic + "/" + subtopic)
 fileReader.onload = function(event) 
 {
  alert(fileReader.result)
 }
 inputElement.onchange = function(event)
 {
  fileReader.readAsText(event.target.files[0])
 }
}
-->
</SCRIPT>
</HEAD>
<BODY BGCOLOR="green">
<FONT COLOR="blue"><H1 ALIGN="center">Help Displayer</H1>
<FORM>
Help on which topic? <B>TOPIC</B>&nbsp;<INPUT NAME="subject1" TYPE="text">&nbsp;&nbsp;<B>SUBTOPIC</B>&nbsp;<INPUT NAME="subject2" TYPE="text"><BR>
<BR>
<INPUT NAME="submit" TYPE="button" VALUE="Help" onClick="help(this.subject1.value, this.subject2.value)"><BR>
<BR>
<INPUT NAME="reset" TYPE="reset">
</FORM>
</FONT>
</BODY>
</HTML>
I'm trying to create a GUI for my shelp.sh standard script command. Needing to use javascript in an HTML page, is part of my rules of my challenge right now, if I'm going to do it now. I don't want to have to install a server in order to do this. This does nothing on click of the help button. Please help me write the file out as an alert. If it's very, very simple, I'm ok with using other languages as well, as long as JavaScript and HTML integrates it together, and I understand what I'm doing. I will tie it in with the shell scripts, AFTER this works. Please help me. When I finish this, it will be used on my network, and shared via github a few different ways.
 
Old 03-18-2024, 09:15 PM   #2
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416

Original Poster
Blog Entries: 43

Rep: Reputation: 36
If this is impossible, just say so please. Also, I would prefer it's cross browser on Linux, but most of the time, it will probably use firefox. If it's also cross platform, and the thing would work on windows, even better. But I don't want it to get too complicated. The owner of the text files, is root, and they are 777 permissions, but could be changed, as long as it's at least readable by ugo.
 
Old 03-18-2024, 09:15 PM   #3
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416

Original Poster
Blog Entries: 43

Rep: Reputation: 36
I can also install the file into the settings directory, if I must.
 
Old 03-18-2024, 09:25 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,706

Rep: Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898
I am not sure it is possible to read a file from the client with a web browser. That would be a big security problem.

Last edited by michaelk; 03-18-2024 at 09:35 PM.
 
Old 03-19-2024, 01:18 AM   #5
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416

Original Poster
Blog Entries: 43

Rep: Reputation: 36
Too bad. I'm declaring it as impossible. Thank you though! It was a nice experiment, while it lasted!
 
Old 03-19-2024, 02:21 PM   #6
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,864
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Maybe you could right click on your desktop and select `Create shortcut` from the context menu.
 
Old 03-19-2024, 03:44 PM   #7
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,226

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
You need Electron (or something similar, like nwjs) for this.
 
Old 03-20-2024, 06:37 AM   #8
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416

Original Poster
Blog Entries: 43

Rep: Reputation: 36
I think node.js and electron are outside of the scope of what I'm doing. I'm only trying to create simple things that work on the web right now. I'm just marking it as impossible, and moving on. For this, since what I wanted to do is impossible, I might just use another tool to create a GUI. Later! Done for now. This would be useful to have, but it's not going to make or break me. Maybe as I need specifically the GUI more, I'll revisit this. I'll just keep working on other stuff for now. Thanks anyway though!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft Visual C++, Reading from File, Reading an XFile not heirarchy Soulkeeper1987 Programming 1 07-01-2012 04:09 PM
Do you think I should use a Qt GUI, a GTK GUI, or no GUI at all? anon02 Programming 5 08-25-2011 06:59 AM
Proftpd 1.3.0 under ubuntu : "530 Login incorrect" displayed on ftp client Hanzo Linux - Networking 3 07-24-2008 08:02 PM
Reading/Wirting file/parsing xml file using javascript fakhrul Programming 1 08-14-2007 05:08 PM
My GUI Gnome is not displayed after backup elg_rein Linux - Software 1 07-25-2005 08:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration