views:

63

answers:

1

Hi, I want to monitor object creation. for example i want to dynamically change some https links to http using javascript. i can do it in the page onload event by fetching all object anchors and can replace the href. but i want to do that at the instance of the object creation instead of waiting till the page has loaded. so to prevent users from clicking any link which had already appeared at the top of the page and if the page is taking some time to load then the url would have had replaced to my desired path. so that is the reason i want to change the href to a different url or replace https to http.

i haven't heard or read about on create event so i am posting it here. people should have alternatives or other options which we have not yet heard, read or used.

+2  A: 

Are you sure JavaScript is the right way to go here? Don't you have access to the server side, to just change the links there? Because users with JS disabled would still see and use https, I don't think you should tackle the problem using JS.

elmac
Yes you are right. After posting this question i modified the code and changed https to http by using javascript DOM. When the page starts a timer starts and it will run till the document onload completes. And once the onload fires i delete the timer. now it is wokring as expected.And then i totally changed the server side scripts to a favorable one which will not use the above code at all. anyway. Thank you.
Jayapal Chandran
So ACCEPT his answer, please :)
Tomasz Struczyński

related questions