when I try cd, console says "cd is not defined"
How do I cd into an iframe in chrome developer tools or firebug lite in chrome?
12.4k Views Asked by Deepan Chakravarthy At
3
There are 3 best solutions below
1
On

In Chrome Devtools, the "context switcher" is available at the bottom of the page. See the <top frame> dropdown? In there you can change where your script is executing from. This is the same, effectively, as cd().
This is explained more in https://stackoverflow.com/a/8581276/89484
Yes, you are right Firebug have this awesome command. I really like it. It's making wotking with
iframesmuch easier. Personally I don't go to Firefox just because thecd()is available in it because I can do whatever I can do with cd in chrome dev tools too.Just use
contentWindowkeyword in your command prompt to access theiframewindowObject. Then you will be good to access any function and variable out there.For example I have a variable in my
iframethat is not accessible via console normally.But still I can access to the variable via
contentWindowlike this:If you want to fire a function do this:
If you want to define some variables(the hardest one):
This is what
cd()actually does. I know it's not as good as Firebugs cd(). But the good news iscd()is coming to Chrome