0

I am beginner of iPhone. I want to call javascript page in webview. I have used script like

    <script src="http://www.infochoice.com.au/modules/applets/flash9/Source/Scripts/swfobject.js" type="text/javascript"></script>
            <div id="ich_flashcontent"></div>
            <script type="text/javascript">
               var ich_calc_detect = new SWFObject("http://www.infochoice.com.au/modules/applets/flash9/Source/Applets/600/LoanRepayments.swf", "ich_LoanRepayments", "595", "330", "9", "#000");
               ich_calc_detect.addVariable("splash_location", "http://www.infochoice.com.au/modules/applets/flash9/Source/Applets/splash_icon.swf");
               ich_calc_detect.addVariable("info_location", "http://www.infochoice.com.au/distributions/flash9/58/info/");
               ich_calc_detect.addVariable("xml_location", "http://www.infochoice.com.au/distributions/flash9/58/");
               ich_calc_detect.addVariable("core_location", "http://www.infochoice.com.au/modules/applets/flash9/Source/Applets/StGeorge/");
               ich_calc_detect.addParam("AllowScriptAccess", "always");
               ich_calc_detect.addParam("wmode", "transparent"); 
               ich_calc_detect.useExpressInstall('http://www.infochoice.com.au/modules/applets/flash9/Source/Applets/expressinstall.swf');
               ich_calc_detect.write("ich_flashcontent");
            </script>

Please give any suggestion and source code which is apply in my app.

3 Answers 3

1

Just a simple:

[webView stringByEvaluatingJavaScriptFromString:%your javascript string%];

Note 10 sec for execution and 10mb of ram per this call or it will be killed no matter if it finished execution or not.

Sign up to request clarification or add additional context in comments.

Comments

1

Try to use [webView stringByEvaluatingJavaScriptFromString:@"your_javascript_here"];

1 Comment

we used this method to communicate between the native part of the app and the javascript inside a webview. I'd encapsulate your javascript in a function and call the function from the app via the suggested method.
0

I've executed java script for UIWebview in the following way

NSString *jsString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '%f%%'",(fontSize * 10.0)];
[self stringByEvaluatingJavaScriptFromString:jsString];
  [jsString release];

Hope it may help you. Here self is an instance of UIWebView.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.