Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

As we have a wonderful concept called hooking where we can create a reference to a function and connect another function In the same way can we create a reference to DOM objects. For example can we create a function and hook it to document.location so that whenever document.location is used the other function must be triggered.

share|improve this question
    
I understand that certain properties in the DOM don't act like typical objects in javascript, for example window.location.href. Assigning that property to a value triggers the event to change pages, though I'm not sure if it's an overrideable feature in javascript or if it's somehow treated differently by the browser. –  Neil Apr 23 '12 at 9:32
add comment

1 Answer 1

You can't do this. Setting document.location to anything will immediately trigger a redirect to whatever string representation the value has.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.