Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lynx with javascript

So I wrote a script in PHP that requires javascript to run with it. I've had a hard time finding the solution on how to run the javascript with php at the same time using some linux tool to make it automatic (since running it in my browser isn't a choice, I need it to be a crontab). Using the "php" command isn't a choice either since it does not run javascript. So I found a solution, it was lynx.

So here is my problem: for some reason, the javascript runs in my browser just fine, but not in lynx. Using lynx the page just loads without any javascript involvement. Is there a way to debug javascript in lynx, kind of what google chrome has where you can view what's going on from console, so I can find out what's causing the script not to run in lynx?

Edit:

So apparently lynx does not support javascript. In that case, my question is, what does? I need to run this script as a browser would but from the linux command prompt. And if OS matters in this case, I am running latest Ubuntu.

like image 777
TheNotSoWise Avatar asked Feb 19 '12 21:02

TheNotSoWise


People also ask

Can Lynx run JavaScript?

Edit: So apparently lynx does not support javascript. In that case, my question is, what does? I need to run this script as a browser would but from the linux command prompt.

Does w3m support JavaScript?

Unfortunately w3m doesn't support JavaScript at all. Show activity on this post.

Does ELinks support JavaScript?

By default, JavaScript is not enabled. We'll need to start elinks, press “Esc” twice to access to the top menu, and go to Setup->Options Manager. Expand ECMAScript menu, select Enable, and Edit to set the value to 1. It seems you have to enable javascript at runtime, taken from here .

How do I enable JavaScript in my browser links?

On the web browser menu click on the "Edit" and select "Preferences". In the "Preferences" window select the "Security" tab. In the "Security" tab section "Web content" mark the "Enable JavaScript" checkbox. Click on the "Reload the current page" button of the web browser to refresh the page.


2 Answers

Lynx doesn't support Javascript.

Update 1

Based on your summary of what you're trying to do (login to a site that requires JavaScript for the password encryption) I'd strongly recommend you look at using Selenium or another browser automation package. Even if you get the password submission working properly without such a layer, the site's probably going to have other issues if you use a minimalist browser like Lynx.

like image 183
sh-beta Avatar answered Sep 28 '22 17:09

sh-beta


Lynx does not support JavaScript, but the alternative text browser ELinks does, based on SpiderMonkey. It's somewhat experimental though; see the manual on how to compile it in.

Also, I'm really puzzled about what you're trying to accomplish here...

like image 22
Thomas Avatar answered Sep 28 '22 19:09

Thomas