Skip to content
Advertisement

Fetching rendered JavaScript from a page (Omniture pixel)?

I have some code (incidentally, it is for Omniture SiteCatalyst) that renders a 1×1 pixel based on some JavaScript object variables I set in the page’s source code. The JavaScript eventually creates an img based on the scripting code, but the img src isn’t hard-coded into the HTML. How can I figure out what the img src is, given the URL of a page? If I just grab the page, I’ll get the pre-rendered JavaScript.

EDIT

For example, let’s say I have this code for StackOverflow.html:

<html>
<script type="text/javascript">
a = 2
document.write(a)
</script>
</html>

How can I fetch StackOverflow.html and somehow get the value “2” instead of all of my scripting code?

Thanks!

Advertisement

Answer

I think the best way to do this is with Selenium, and then inject some javascript in the page to either mine the DOM, or retrieve the value from the window global if appropriate.

Advertisement