I'm trying to debug navigation issues with my app. The problem is in navigating back through an iframe on a page.
I am using a backbone router in a SPA cordova app, testing on iOS. I some of the application pages contain iframes that load web content hosted on the web. While testing on the browser I don't have issues. On an iPhone I found that navigating backward through a content iframe history doesn't affect the iframes current document. In other words, the back button doesn't cause the iframe to go back. The content wasn't changing and the window.location.href isn't updating either. The funny thing is I eventually pop off the history entries for the iframe and return to the application page history, which works like a charm.
Creating a stripped down prototype with the same setup but without the plugins and application modules I have written works just fine. I need to identify, what could cause an iframe to fail to update its content when the history api is called, while the joint session history continues to work for the parent document
This behavior was a side effect that resulted from including the console cordova plugin (org.apache.cordova.console). Its a plugin meant to redirect console output.
Here is the one file that implements the feature
#import "CDVLogger.h"
#import <Cordova/CDV.h>
@implementation CDVLogger
/* log a message */
- (void)logLevel:(CDVInvokedUrlCommand*)command
{
id level = [command argumentAtIndex:0];
id message = [command argumentAtIndex:1];
if ([level isEqualToString:@"LOG"]) {
NSLog(@"%@", message);
} else {
NSLog(@"%@: %@", level, message);
}
}
@end
Nothing here looks like a smoking gun, so there might be other issues in the initialization process left to uncover. However, removing the plugin clears up the side-effects and I can move forward.
I did dig up some interesting articles. http://khaidoan.wikidot.com/ on the nuances of adding iframes to the page and techniques for affecting specific kinds of history recording. And chromium's implementation for out of process iframes.
http://www.chromium.org/developers/design-documents/oop-iframes