Webview not displaying pages

I created a repl with the latex template, it contains a nice httplz server that should show some webpages. The webview panel opens automatically, but it doesn’t display pages, it just says “Start a server to see hosted output”.

I found some references about checking that the server listens on 0.0.0.0, netstat says that the server is doing this correctly.

I tried with an empty template project too, just starting httplz with an index.html, and the problem is the same. Listening on 0.0.0.0 but webview says “Start a server to see hosted output”.

What to do? Thanks.

Does your webview say ‘srcdoc’? If so, replace ‘srcdoc’ with ‘/’.
Edit: I’ve checked out the LaTeX template, and you are not supposed to open the Webview, you are supposed to open main.pdf and edit main.tex.

1 Like

My webview says this. I don’t know where would you mean that I’d find a “srcdoc”?

Yes of course I’m supposed to just take the main.pdf, but since the webview automatically opened I was trying to check what it is. There’s a nice index.html all ready to be viewed and a nice web server ready to be run by a nice script. Therefore I wonder what is not working.

Moreover, the problem presents itself in a different situation too, where I would just like to try it (the empty project) indipendently from tex, still it doesn’t work.

Hmm, the webview does not open automatically for me. If you want it to, copy your code to an HTML template, and then run bash runner.sh every time you want to update the PDF.

I’m not interested in the PDF, I’m interested in the Webview. Creating an HTML template it seems that the workings are really different. There are no web servers running in the VM, seemingly a totally different deploy is occurring.

The workings are not different. Both the HTML and LaTeX templates have the shell, but the HTML template will display the index.html.

Excuse me, but they at least LOOK VERY different. I don’t know if this difference is then flattened somewhere, in case I’d like to understand where.

The LaTeX template requires a script to be manually run, has a local http server, and doesn’t work.

The HTML template starts automatically, does not have an http server, is served from external replit services, and it works.

There are evident differences. It doesn’t seem obvious to me how to reconcile the two, I wouldn’t be asking the question otherwise. Is it obvious for you instead?

Could you send a link to your repl? It’ll be easier to examine the problem further.

Of course: https://replit.com/@AndreaPalomba/ExhaustedVastComputation
Even if it’s just the LaTeX template right after creation.

But maybe I am misunderstanding the webview? And it is not meant to show a local server, only a special replit one?

Well, the repl doesn’t have a Webserver, in a sense that there isn’t a host, port and backend. Because of this, the repl will not show the webpage.

Ok so you are saying what I was suspecting: it is not meant for local services.

Anyway, yes the project has a local webserver. There is an httplz package installed (and run by the startup script) which I understand as clearly intended for this purpose.

So, if not this, what would be the intended way to start a webserver to show things in the webview?

A question first, is there a need for the analysing of the pdf file?

Of course not. But as already clarified earlier, at the moment I am not interested in TeX or the pdf. It is just a coincidence that I discovered this thing by looking at what the repl was trying to do and the repl was the LaTeX one, it could be a different one and I don’t care. I am now just curious about the workings of the webview, since, if it works, I may use it for other things.

As said earlier, yes if I use the html+js+css template there are other services running and everything is ok. But I am curious to understand how those services are made to work, since it clearly is not in the same way (nor as easy?) as starting a local webserver.