views:

10

answers:

1

I'm using Snap.com service to create snapshots to Wikipedia links on my web page. It works fine with the links in the page when page is loaded. But it doesn't work when new links are created and inserted into the web page via Javascript.

The Snap.com script is called once when the page is loaded:

<html>
<body>
   ...
   <script type="text/javascript" src="http://shots.snap.com/ss/my-id/snap_shots.js"&gt;&lt;/script&gt;
</body>
</html>

Is there a way to reacivate their script after new DOM nodes are created in the document? Or some other way to solve this issue?

+1  A: 

I've found the solution by inspecting Snap.com sources. The following code forces Snap.com to reprocess the page:

SNAP_COM.shot_main_js_called = false;
SNAP_COM.shot_main_js();
pheasant