开发者

Ipad - my Webview / UIkit safari browser won't run javascript

I'm using webview in my xcode javascript refuses to run. has anyone got any ideas why this would happen? could it be that an error in my javascript is blocking it from running? or could it be that javascript has to be setup somehow?

I'm new to ipad dev. Let me know what you need me to post and i will

Update

Okay as suggested I made a simple test.

<div id="test" style="color:black">sfkjldsf</div>
<script type="text/javascript">
    document.write('TEST YOU PIECE OF CRAP');
</scri开发者_C百科pt>

<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script type="text/javascript">
    $(function(){
    $('#test').css('background-color','red');
    });
</script>
</body>

It shows me a few things. 1. javascript does actually work 2. the problem lies with loading up jquery 3. if i load jquery locally, ie src="jquery.js" it doesn't work. But the document.write command does work. 4. If i load jquery as above from the cdn, it works fine.

My issue is that my ipad won't have internet connectivity so i can't load jquery from the cdn.

Any ideas?

Jason


This works, in general, obviously, so something is wrong in your case.

My suggestion is to make a very simple sample/test for yourself, get that working and then build upon it (standard programming strategy for when something doesn't work).

For this simple example, put the javascript right into the html file. If that works, then likely it's the path to the javascript file that's broken (they are a little odd if I recall correctly).

We'll need more information to help you more. If you make a simple test then it'll be short enough to include.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜