I have the following javascript code on my page: if (top.frames.length!=0) top.location=self.document.location; history.forward(); Code (markup): It prevents users from going back once they click a link. Now I need the following modification: The script should only work on links to htm/html files. If the visitor clicks a link to an image (jpg), they should be able to go back. I have no clue how to do this. Any help, please?