Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Just a quick update for anyone still struggling with this... I was having the exact same problem where I had an html page with the prototype.js library loaded in the &lt;head&gt;&lt;/head&gt; section of the page. But the library was not being loaded when I opened the same page within a WebView in a Cocoa app. Actually, no script files being loaded (even my own) seemed to work in the WebView.</p> <p>I downloaded the above github code that from the link pjb3 provided, hoping that maybe he'd found a fix and updated it. No such luck. It still had the same problems.</p> <p>And then I decided to look in the package contents of the compiled app (so that would be WebViewApp/Contents/Resources off of the build/Debug or build/Release directory where XCode has compiled your app)... <strong>Oho! The javascript files he had put in the Resources section of the XCode project weren't actually being copied over to the built app's Resources directory.</strong> I looked in my project and it was the same problem. <strong>The fix? Simply drag any of the scripts you've added into the "Copy Bundle Resources" section of your app target in XCode and voila, they'll be there (and things will actually work!).</strong> </p> <p>I thought everything that you put in Resources was getting copied over automagically, but I guess it wasn't. And unfortunately with a WebView, unless you do a bit of work, you don't have all the great web debugging stuff that Firefox or Safari would have that would have made this problem easier to find. So, when in doubt, check if your actual compiled app has the resources it needs under its Resources directory (is this maybe the programmer's version of "Is it plugged in?"?). This took me a lot of head scratching and my only consolation for the lost hours is that I can maybe save some other folks from the same. Happy coding!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload