4

I have a javascript function that currently is inside a html file.. And in my xcode project I have a button linked to a UIWEBVIEW (linked to my local html file which has the javascript )..

The code inside my html file is.

<script type="text/javascript">
var now = new Date();
var day = now.getDate();

if (day % 2 == 0)
 alert("Today is Day 2");
else
    alert("Today is Day 1");

</script>

Currently, it's displaying what I want, but the only problem is the alert title is displaying day.html . Anyway I can use xcodes UIAlert function but with my javascript?

Here is the image:

enter image description here

casperOne
  • 73,706
  • 19
  • 184
  • 253
Rahim Jan
  • 126
  • 11
  • Please post your answer *as an answer* and if it solves your problem, accept *that* answer. By placing the answer in the question, it will be likely construed as "not a real question" and could possibly be closed. – casperOne Dec 25 '11 at 14:19

1 Answers1

1

You can not change the title inside the UIWebView, however you could do some nasty trickery like this How to call Objective-C from Javascript? to accomplish what you want.

Community
  • 1
  • 1
Ecarrion
  • 4,940
  • 1
  • 33
  • 44