I'm glad you found an alternative to some of those issues. Regarding the redirect, window.location* will throw a caja parsing error. There is something you can do as an alternative. When you would normally call your redirect function, instead make an OpenSocial
gadgets.io.makeRequest method call with the url you are attempting to forward the user to. This will make an ajax request to grab that page content and, once it returns, you can use DOMNode.innerHTML to inject your page content into the same location. This will mimic the same effect as a redirect without actually having to redirect.
Just a word of warning though, when content is injected into the page using innerHTML, the caja client side sanitizer comes into effect, which will most likely strip your JavaScript from the returned content (and sometimes your css). Here are some tips for adjusting for that:
- If you have JS onClick events, instead assign an id to the node and then, once innerHTML has completed, use addEventListener / attachEvent to inject your click event - that's what we do for some of our apps and it works well.
- If you css style blocks are being stripped, inline all css to the nodes, that should repair the issue.
Please let us know if you run into any issue, we'd be glad to assist.
Jonathan LeBlanc
Senior Software Engineer
Yahoo! Developer Network
I mean, you can't use the form like this: <form id="browse" name="browse" method="post" action="test.php" enctype="multipart/form-data >