Programs running inside a browser....

  • Thread starter Thread starter fog37
  • Start date Start date
  • Tags Tags
    Programs Running
Click For Summary
The discussion centers on the use of web browsers to run locally stored programs, particularly focusing on Jupyter Notebooks as a key example. Jupyter operates by using a local server that communicates with the browser, allowing users to run code in languages like Python, R, or Julia without needing to manage separate versions for different operating systems. This setup simplifies development and testing across various platforms, as the browser serves as a universal interface. Participants highlight the advantages of using browsers for rendering, such as support for JavaScript and graphics, while also acknowledging challenges like the need for token authentication for security. The conversation touches on the technical structure of Jupyter, which consists of a web app, a server, and a kernel, clarifying that the kernel is distinct from the Python interpreter. Additionally, there are discussions about changing default browsers and the implications for user experience, particularly regarding token requirements. Overall, the thread emphasizes the efficiency and flexibility of using a browser-based approach for local applications.
fog37
Messages
1,566
Reaction score
108
TL;DR
browser, client-based software
Hello,

I noticed that there are some programs that use the browser to run. For example, when launched, the program runs inside the browser as it it was our computer was a local server. I am familiar with the client/server model where a computer (client) communicates with a remote machine (server) to request and get information.

But the scenario I describe is different...Why would we want to create a program stored on our machine and using the resources on that machine but run it through the browser? I am confused...
 
Technology news on Phys.org
fog37 said:
there are some programs that use the browser to run

Can you give a specific example?
 
fog37 said:
Why would we want to create a program stored on our machine and using the resources on that machine but run it through the browser?
Well, I write JavaScript programs all the time that are designed to run locally.
In this case, the browser is just the target renderer.

I can write a program in notepad and run it right away - with zero overhead in terms of dev environment, compiling, etc.
 
As Dave has pointed out, there are languages that were developed specifically so that executables could be run inside a browser. Take a the example of a simple web page that has to run not just on different browsers but on all of the recent iterations of each browser. Generic served up web pages may have different behavior depending on the browser & version but you can modify the behavior of the served page locally by using JavaScript (as one example) to change characteristics of the page depending on which browser & version is rendering the page.
 
From reading release notes from previous Windows versions: provide users a standard interface using the default web browser locally. Providing standard user interface (UI) propelled Windows, based loosely on the Kay-Pro UI, over DOS on personal computers (PC's).
 
Last edited:
Klystron said:
From reading release notes from previous Windows versions: provide users a standard interface using the default web browser locally. Providing standard user interface originally propelled Windows over DOS, IIRC.
How about the fact that a served web page has to run on both Windows and Mac ? Also, versions DO sometimes make changes in behavior. HTML5 has been an attempt to fix that but I don't know how successful it has been since I am no longer involved in multi-browser development.

When I was with Pantone, my development and test teams had to make sure that our web pages were served up as desired on numerous different browsers and several version of each AND accommodate differences between Windows and Apple and Unix-based machines. It was a serious pain in the butt and took a fair amount of JavaScript as I recall.

It usually took more time to test changes than it did to write the changes.
 
  • Informative
Likes Klystron
A good example of this scheme is the one used by Jupyter Notebooks. The UI is the browser which interacts with a server that runs your Python, R or Julia programs. The server can either be local, the most common case or remote handling multiple users.

Why use the browser? The browser has support for JavaScript and for SVG graphics as well as Mathjax for latex formatting of equations And is great at rendering content. This means the server is freed from the task of rendering images and graphics unless that’s the specific action of the users program.

Jupyter Notebooks can with the help of the server do detailed calculations and then display them on the browser window. The weakness is in interactive graphics since the browser plus server isn’t ideally suited to do that type of high performance task.
 
  • Informative
  • Like
Likes lomidrevo and Klystron
PeterDonis said:
Can you give a specific example?
Sure, I am specifically thinking about Jupyter notebooks. The application, Jupyter, comes with a kernel (which is the program itself that runs the notebook) and its executions is run within the browser (Internet Explorer is automatically run).

I am accustomed to applications (software) stored and running on my computer (client-based software) and software run remotely on a server (Google docs, or some other program run from the cloud).

I am not sure why the program Jupyter uses the browser and why the my own computer is acting like a "local server" since I am not connected to any local network (just a single computer).

Also, which is something annoying, everytime I launch Jupyter I am asked for the token. Is there a way around that?

Thanks!
 
Oh, sorry.

I just saw all your replies, in particular Jedishrfu about Jupyter notebooks. I will read and study them.
 
  • #10
fog37 said:
I am not sure why the program Jupyter uses the browser
Because that means that the authors only have to write one version of the software which works on (almost) any computer that has a browser. Otherwise you have to write different user interface layers for Windows, MacOS, Linux etc, and keep them all up to date according to the different software lifecycles of each environment.

fog37 said:
and why the my own computer is acting like a "local server" since I am not connected to any local network (just a single computer).
Browsers connect to web servers (they can also read static files but that is not going to work for Jupyter because it needs to work dynamically) so Jupyter runs one for the browser to connect to.
 
  • Like
Likes sysprog
  • #11
phinds said:
How about the fact that a served web page has to run on both Windows and Mac ?
Not a problem in 2020; Microsoft have dropped support for everything before IE11 and there is now tooling that runs automatically that irons out all the remaining differences between browsers.

A bigger concern is making sure that a web page or app is usable on an iPhone as well as a 28" 4k monitor.

phinds said:
It usually took more time to test changes than it did to write the changes.

That hasn't changed though :smile:
 
  • #12
pbuk said:
Because that means that the authors only have to write one version of the software which works on (almost) any computer that has a browser. Otherwise you have to write different user interface layers for Windows, MacOS, Linux etc, and keep them all up to date according to the different software lifecycles of each environment.Browsers connect to web servers (they can also read static files but that is not going to work for Jupyter because it needs to work dynamically) so Jupyter runs one for the browser to connect to.
Thanks pbuk. So, you mean that the Jupyter kernel (designed for a specific programming language. There are kernels for R and other languages) acts like a local server to which the browser connects to. Did I understand that correctly?

What about that token that the local server keeps asking for? Is it possible to disactivate that? I know it is possible somehow...
 
  • #13
fog37 said:
Thanks pbuk. So, you mean that the Jupyter kernel (designed for a specific programming language. There are kernels for R and other languages) acts like a local server to which the browser connects to. Did I understand that correctly?
Not quite, there are three components involved:
  • the Jupyter notebook web app (written in JavaScript which is the only program language browsers understand), which communicates with
  • the Jupyter notebook server (written in Python), which communicates with
  • a Jupyter kernel (either the iPython kernel which is the default or some other one).
fog37 said:
What about that token that the local server keeps asking for? Is it possible to disactivate that? I know it is possible somehow...
Yes, you need to set a password. https://jupyter-notebook.readthedocs.io/en/latest/public_server.html#automatic-password-setup

If Jupyter allowed access without a token or password then any website you visit while the notebook server is running could gain control over your computer. The same is true if you set a blank password so don't do that.
 
  • Like
Likes fog37, lomidrevo and jedishrfu
  • #14
Alright! Thank you. So we effectively download a) the kernel and b) a server software component when we download Jupyter. The browser is already there.
  • The sole purpose of the local server component is to communicate with the browser, correct? Without token or password, and if an internet connection is on, someone external could connect to my local server and do damage.

  • Thanks for the password help. As far as changing the browser that gets automatically launched when starting Jupyter, I will look for some command online to change that to chrome.

  • What would be an example of another popular software package that works like Jupyter (kernel/server/browser)?
Thanks!
 
  • #15
Docker projects often work that way. Folks would create a server, package it as a Docker image, and access the server using a web browser.

A simple example would be in Python using the Flask package, you can develop a simple web service that could be packaged inside a Docker image. Actually in this case, you don’t even need the Docker image as you could run flask directly / locally and still access it via the web browser.
 
  • Like
Likes fog37
  • #16
fog37 said:
Summary:: browser, client-based software

But the scenario I describe is different...Why would we want to create a program stored on our machine and using the resources on that machine but run it through the browser? I am confused...
I can give one example of why sometimes you don't want to do this.

My company recently switched to a different model of sharing some files (using SharePoint), where you can click on a file in the server list and check it out for editing. We use this feature a lot, and in my group we also use it to create our shared Weekly Reports. When clicking on the link in a browser, it uses the online version of Excel to open up the Report file and enable editing before checking it back in.

The problem is that our Weekly Report file has grown to about 5MB, and the online Excel version has a max file size of about 2MB with no way around it. Most modern browsers for Windows seem to use the online application feature now, so we were kind of stuck. Then IT figured out that IE 11 still uses the PC's version of Excel, so as long as we stick to IE 11 for checking out that file, we are okay.
 
  • Haha
  • Like
Likes fog37 and jedishrfu
  • #18
fog37 said:
  • The sole purpose of the local server component is to communicate with the browser, correct?
To communicate with the browser at one end and with the Python kernel (or another kernel) at the other, yes.

fog37 said:
  • Without token or password, and if an internet connection is on, someone external could connect to my local server and do damage.
No, not directly. But they could execute JavaScript in your browser that can connect to your local server and do damage.

fog37 said:
  • Thanks for the password help. As far as changing the browser that gets automatically launched when starting Jupyter, I will look for some command online to change that to chrome.
The easiest way is to change your default browser in Windows - hit the start key and type 'default apps'.
 
  • Like
Likes fog37
  • #19
berkeman said:
Most modern browsers for Windows seem to use the online application feature now, so we were kind of stuck. Then IT figured out that IE 11 still uses the PC's version of Excel, so as long as we stick to IE 11 for checking out that file, we are okay.
Please pardon me for wondering how you could be ok with using IE 11 ##-## :wink:

From https://docs.microsoft.com/en-us/sh...office-app-fails-opening-list-item-attachment:

Problem
1606021516504.png

Solution
1606021386684.png
 
Last edited:
  • Like
Likes pbuk
  • #20
sysprog said:
Please pardon me for wondering how you could be ok with using IE 11
Actually, the full story is that the company I work for was recently purchased by a *much* bigger company, and that is what their IT department told us to use. They are looking at updating their tools, but it won't be any time soon. Thanks for the alternate method -- I'll look into that.
 
  • Haha
  • Like
Likes fog37 and jedishrfu
  • #21
pbuk said:
To communicate with the browser at one end and with the Python kernel (or another kernel) at the other, yes.No, not directly. But they could execute JavaScript in your browser that can connect to your local server and do damage.The easiest way is to change your default browser in Windows - hit the start key and type 'default apps'.
Hi pbuk,

I change the defoult browser to Chrome and Jupyter works without the need for a token or password...How come? Maybe I set a password up in the past specific to Chrome which means the notebooks automatically open without needing to insert any token/password?
 
  • #22
fog37 said:
Hi pbuk,

I change the defoult browser to Chrome and Jupyter works without the need for a token or password...How come? Maybe I set a password up in the past specific to Chrome which means the notebooks automatically open without needing to insert any token/password?
If Jupyter is opening the browser itself then it sends a token when it opens the browser; this is then used to set a cookie in the browser so no further authentication is required.

https://jupyter-notebook.readthedocs.io/en/stable/security.html
 
  • Like
Likes fog37
  • #23
Thanks. It did open the browser itself even before but still requested the token when the default browser was IE. Now that Chrome is the default, no more to worry so I guess the cookie was set before on Chrome...
 
  • #24
fog37 said:
Thanks. It did open the browser itself even before but still requested the token when the default browser was IE.
Possibly IE ignores the query portion when launched with a URL, but never mind you've got it working now and will be much better off in Chrome anyway.
 
  • #25
pbuk said:
Not quite, there are three components involved:
  • the Jupyter notebook web app (written in JavaScript which is the only program language browsers understand), which communicates with
  • the Jupyter notebook server (written in Python), which communicates with
  • a Jupyter kernel (either the iPython kernel which is the default or some other one).

Yes, you need to set a password. https://jupyter-notebook.readthedocs.io/en/latest/public_server.html#automatic-password-setup

If Jupyter allowed access without a token or password then any website you visit while the notebook server is running could gain control over your computer. The same is true if you set a blank password so don't do that.
Hello pbuk,
I has reviewing this old thread and reading your reply. I have a quick question if ok:

I downloaded the Anaconda distribution and got Jupyter notebook along with it. You mention that Jupyter comes with 3 software components:

1) kernel (interact with the server)
2) server (interacting with the web app)
3) web app written in JS (interacting with our browser)

-- Anaconda offers a Python interpreter. Is that same Python interpreter the interpreter that the Jupyter notebook app is using when we write notebooks? I can see the interpreter Anaconda uses via the Anaconda prompt...
1631283038905.png

-- The Jupyter "kernel" is something different from the interpreter or are the same thing? The term "kernel" is used in the context of an operating system like Linux to indicate the deeper mechanics of the OS...

Thanks!
 
  • #26
fog37 said:
-- Anaconda offers a Python interpreter. Is that same Python interpreter the interpreter that the Jupyter notebook app is using when we write notebooks?
Possibly. If you want to know which Python executable you are running do
Python:
import sys
print(sys.executable)

fog37 said:
-- The Jupyter "kernel" is something different from the interpreter or are the same thing?
It is something different. Jupyter can run many different languages (it was initally designed for Julia, Python and R), the default Jupyter kernel for Python is iPython (follow the link for some more background).
 
  • Like
Likes sysprog, fog37 and jedishrfu
  • #27
pbuk said:
Possibly. If you want to know which Python executable you are running do
Python:
import sys
print(sys.executable)
It is something different. Jupyter can run many different languages (it was initally designed for Julia, Python and R), the default Jupyter kernel for Python is iPython (follow the link for some more background).
Eventually, the Python commands we type in the notebook will reach the Python interpreter and be converted to bytecode and machine code. a Jupyter notebook, I was reading, is a JSON file. So the kernel must a be part of the interpreter or vice versa...
 
  • #28
Of course, the whole Jupyter setup is a great example of a web client / web server system. The web server at the request of the web client, invokes the python interpreter to get its results that are then relayed back to the web client using web protocols.
 
  • Like
Likes pbuk

Similar threads

  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 22 ·
Replies
22
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 18 ·
Replies
18
Views
4K