@@ -34,7 +34,7 @@ foreign export ccall callWithWebView :: WKWebView -> StablePtr (WKWebView -> IO
3434foreign export ccall callWithCString :: CString -> StablePtr (CString -> IO ()) -> IO ()
3535foreign export ccall callIO :: StablePtr (IO ()) -> IO ()
3636foreign import ccall addJSaddleHandler :: WKWebView -> StablePtr (IO ()) -> StablePtr (Results -> IO ()) -> StablePtr (Results -> IO Batch) -> IO ()
37−foreign import ccall loadHTMLString :: WKWebView -> CString -> IO ()
37+foreign import ccall loadHTMLStringWithBaseURL :: WKWebView -> CString -> CString -> IO ()
3838foreign import ccall loadBundleFile :: WKWebView -> CString -> CString -> IO ()
3939foreign import ccall evaluateJavaScript :: WKWebView -> CString -> IO ()
4040foreign import ccall completeSync :: JSaddleHandler -> CString -> IO ()
@@ -44,7 +44,9 @@ foreign import ccall mainBundleResourcePathC :: IO CString
4444jsaddleMain :: JSM () -> WKWebView -> IO ()
4545jsaddleMain f webView =
4646 jsaddleMain' f webView $
47− useAsCString (toStrict indexHtml) $ loadHTMLString webView
47+ useAsCString (toStrict indexHtmlBaseURL) $ \url ->
48+ useAsCString (toStrict indexHtml) $ \html ->
49+ loadHTMLStringWithBaseURL webView html url
4850
4951-- | Run JSaddle in a WKWebView first loading the specified file
5052-- from the mainBundle (relative to the resourcePath).
@@ -123,6 +125,10 @@ jsaddleJs = ghcjsHelpers <> "\
123125 \})();\n\
124126 \"
125127
128+
129+indexHtmlBaseURL :: ByteString
130+indexHtmlBaseURL = "file:///tmp/index.html"
131+
126132indexHtml :: ByteString
127133indexHtml =
128134 "<!DOCTYPE html>\n\
@@ -140,4 +146,3 @@ mainBundleResourcePath = do
140146 if bs == nullPtr
141147 then return Nothing
142148 else Just <$> packCString bs
143−