Error on mobile but not desktop
I have a very simple request block that just renders some basic HTML:
url: https://mysite.com/page.php
res-type: md
render
This works fine on desktop Obsidian. In mobile, the blocks do not render and show this error:
Error: undefined is not an object (evaluating 'responseData.headers["content-type"].includes')
This same URL used to work fine in mobile, but something changed with an update. Is there some specific header the PHP script needs to output for this to work?
Have you try to run it without the res-type and/or without render?
This may be caused by the sanitizer (not sure, just my first hypothesis). I don't know how to recreate this behavior.
Hello @nickian, It seems that only these tags are allowed, although it is strange that it works on desktop but not on mobile.
It seems to be doing the same thing when I remove res-type and render.
I think I'm only using tags on that whitelist. I have a script that makes a request to Coin Market Cap to get crypto prices and it just outputs this:
echo '<div style="display:block; width:100%;">';
echo ' <img src="btc.png" width="15"/> ';
echo '<strong>BTC</strong>: $'.number_format(round($response['data'][1]['quote']['USD']['price'], 2), 2). ' ('.round($response['data'][1]['quote']['USD']['percent_change_24h'], 2).'% in last 24h)';
echo '</div>';
echo '<div style="display:block; width:100%;">';
echo ' <img src="eth.png" width="15"/> ';
echo '<strong>ETH</strong>: $'.number_format(round($response['data'][1027]['quote']['USD']['price'], 2), 2). ' ('.round($response['data'][1027]['quote']['USD']['percent_change_24h'], 2).'% in last 24h)<br/>';
echo '</div>';
echo '<div style="display:block; width:100%;">';
echo ' <img src="doge.png" width="15"/> ';
echo '<strong>DOGE</strong>: $'.number_format(round($response['data'][74]['quote']['USD']['price'], 2), 2). ' ('.round($response['data'][74]['quote']['USD']['percent_change_24h'], 2).'% in last 24h)<br/>';
echo '</div>';
echo '<div style="display:block; width:100%;">';
echo ' <img src="shib.png" width="15"/> ';
echo '<strong>SHIB</strong>: $'.number_format($response['data'][5994]['quote']['USD']['price'], 8, '.', ''). ' ('.round($response['data'][5994]['quote']['USD']['percent_change_24h'], 2).'% in last 24h)';
echo '</div>';
Inside a <?php> tag? If the endpoint returned only the html I think there would be no problem.
I'm thinking of adding a way to turn HTML sanitizing on and off, what do you think?
I think that would be good. I'm still having the issue. But now it says Error: JSON Parse error: Unrecognized token '<'