I'm unable to call a function within a dynamically created iframe, though the same code works from the js console. I'm wondering if the issue might be something with how crossrider "sees" window objects.
The code in question is at:
http://pastie.org/1909297
Help get this topic noticed by sharing it on
Twitter,
Facebook, or email.
Twitter,
Facebook, or email.
-
I figured it out, I needed to add 'unsafeWindow' before the call to execute the in page javascript.
For others needing help with this, the documentation is at: http://crossrider.wiki.zoho.com/Avoid... -
-
EMPLOYEE
1Mike,
You have touched important issue so maybe I will add some info re different browsers behavior:
- Chrome
is fully working in a sandbox and it does not support the unsafeWindow parameter (so please check your code at Chrome as well).
You have full access to the DOM but no real access to the page's JS variables and functions.
You can call page's local JS functions by using this api:
appAPI.dom.callPageFunction
which allows you to execute local JS function but does not return the return value of the function (if exists). note: this api function isn't documented yet
- Firefox:
with Firefox as you mentioned there is difference between the 'window' object which is the app sandbox window object and unsafeWindow object which is the actual page 'window' object.
- Internet Explorer:
In IE there is no difference between 'window' and 'unsafeWindow'. They both are actually pointers to the actual page.
Although we are trying to keep things the same for all browsers, in some rare cases like this, it's better to understand the differences between the browsers (I guess this should be under the 'Advanced Techniques' section at the Crossrider book :) - Chrome
-
-
Koby,
I'm trying to sort out the best way to put into practice a method of calling the in page js function inside of the page's iframe.
Is appAPI.dom.callPageFunction(my_page_function()); what I should be doing? Also, how is that call scoped as far as having an iFrame on the page (my issue).
Thanks,
Mike -
-
Mike,
To better understand the issue, let's try schedule a chat (gtalk?) or Skype session.
I have to admit I'm not sure how to handle this situation where you need to run js function from within iframe... It's also important to know if it's your iframe, other site iframe, etc. I believe discussing this together will solve it (or at least find a good workaround).
You have my email so pls let me know when when it's a good time to talk.
K. -
Loading Profile...




