I would prefer not to glue it. what about rubber banding it and then ruberbanding the other rubber band to a rubber band on the outside of the tank. lol(worlds most repetitive sentence with rubber band included the most)
If you hang it over the side like that, I don't think it will attach since it will move around in the current. As kirk said, just put a rock of it firmly against the glass and it will do the rest on it's own.