0

I don't really understand how to us PhantomJS in my webpage... I've been able to use as a binary on Windows but now need to include in my web app online.

I've installed the Linux version and gotten the source on my machine, but how to actually use it? This is my very simply hello word test below. I thought I would open the console see "Hello World!" but nothing happens. What am I doing wrong? And even in hello.js, where do we actually call the phantomjs executable?

<html><head>
<script type='text/javascript' src='js/hello.js' />
<script>
console.log('Hello, world!');
phantom.exit();
</script>
</head>
<body>
</body>
</html>

Hello.js, as on the webisite:

console.log('Hello, world!');
phantom.exit();

By the way, I'm running CentOS and I got the tarball for PhantomJS and unpacked it into my main www folder, I'm not sure what to do? I ran phantomjs --version on the linux prompt but it doesn't recognize it.

2
  • 2
    I don't think you're supposed to be able to use PhantomJS in a web app. Commented Feb 11, 2013 at 12:51
  • Yeah you're right I just realized that... Commented Feb 11, 2013 at 12:52

1 Answer 1

1

Okay I just realized PhantomJS can't be used in a regular javascript filed referenced on a webpage. Also, I just had to do ./phantomjs instead of phantomjs on the prompt to be able to run it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.