Reputation: 12747
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.
Upvotes: 0
Views: 890
Reputation: 12747
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.
Upvotes: 1