• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

capturing javascript output from module

 
Zack Lamm
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on a project that is meant to speed up the load
time of a website. Basically, what I need to do is translate
a javascript module and save the output to a database.

I've tried using javax.script.*, but the modules use implicit
objects (such as "navigator"), so when I try to evaluate
the modules my app crashes. Is there any way around this?
Possibly using other tools such as Python/Ruby???

Program outline:

1. grab module from file or url
2. interpret module and capture output
3. save output to database

An example of one of the modules I'm working with:
Javascript module

Any comments, suggestions are welcome...I'm up against a brick wall here.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64618
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Zack Lamm:
Basically, what I need to do is translate
a javascript module and save the output to a database.


Translate it to what?
 
Zack Lamm
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need the output from the Javascript, i.e., all the document.write statements...
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A script like that only makes sense in the context of a web page. Are you using a library like jWebUnit to simulate a web page environment?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64618
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
'm working on a project that is meant to speed up the load
time of a website.


Perhaps you should explain what you mean by this.

If you are trying to "speed up the load time" by running the JavaScript on the server before it gets to the page, well, that's just not going to be possible.
 
Zack Lamm
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I haven't tried jWebUnit, does it support javascript?
I tried using httpunit, but it has limited javascript support.
Simulating a web environment is exactly what I want to do.
Basically, all I need is the javascript module to run through
a browser so I can capture the output, like I said before, I
need everything that's produced from the document.write()
statements. That's what goes into the database: the actual
content that's produced from the javascript module.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't fully understand what you're trying to do, but I prefer jWebUnit over HttpUnit. It has much better support for DOM and JavaScript, and also operates on a higher level, which makes for a more pleasant development experience.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic