Hi
I have added a HTML file to my project so that it's embedded within the application.
With the following code I can view the HTML file in the iPhone simulator.
Now this works as it can Find the Embedded HTML file "TestHTML.html"
My question is how do I pass parameters into the HTML file ie "Fred=1 Bert=-2.2 Harry=3" so that the java script can use them.
If I try the usual method by appending "?Fred=1.2&Bert=-2.2&Harry=3" to the URL then the application does not work, I suspect its trying to find the file "TestHTML.html?Fred=1.2&Bert=-2.2&Harry=3"
This does NOT work
any suggestions please
Keith
I have added a HTML file to my project so that it's embedded within the application.
With the following code I can view the HTML file in the iPhone simulator.
Code:
NSBundle *bundle = [ NSBundle mainBundle ];
NSString *path = [ bundle bundlePath ];
NSString *fullPath = [ NSBundle pathForResource:@"TestHTML" ofType:@"html" inDirectory:path ];
NSString *params = @"?Fred=1.2&Bert=-2.2&Harry=3";
NSString *fullURL = [ NSString stringWithFormat:@"%@%@", fullPath, params ];
// fullPath = "/Users/keith/Library/Application Support/iPhone Simulator/User/Applications/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/TestApp.app/TestHTML.html"
[ self loadRequest:[ NSURLRequest requestWithURL:[ NSURL fileURLWithPath:fullPath ] ] ];
Now this works as it can Find the Embedded HTML file "TestHTML.html"
My question is how do I pass parameters into the HTML file ie "Fred=1 Bert=-2.2 Harry=3" so that the java script can use them.
If I try the usual method by appending "?Fred=1.2&Bert=-2.2&Harry=3" to the URL then the application does not work, I suspect its trying to find the file "TestHTML.html?Fred=1.2&Bert=-2.2&Harry=3"
Code:
// fullURL = "/Users/keith/Library/Application Support/iPhone Simulator/User/Applications/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/TestApp.app/TestHTML.html?Fred=1.2&Bert=-2.2&Harry=3"
[ self loadRequest:[ NSURLRequest requestWithURL:[ NSURL fileURLWithPath:fullURL ] ] ];
This does NOT work
any suggestions please
Keith