diff --git a/src/core/layout/qgslayoutitemhtml.cpp b/src/core/layout/qgslayoutitemhtml.cpp
index 1f15a6ec3707..98a2a8b89a8a 100644
--- a/src/core/layout/qgslayoutitemhtml.cpp
+++ b/src/core/layout/qgslayoutitemhtml.cpp
@@ -241,6 +241,7 @@ void QgsLayoutItemHtml::loadHtml( const bool useCache, const QgsExpressionContex
if ( !loaded )
loop.exec( QEventLoop::ExcludeUserInputEvents );
+#ifdef WITH_QTWEBKIT
//inject JSON feature
if ( !mAtlasFeatureJSON.isEmpty() )
{
@@ -251,6 +252,7 @@ void QgsLayoutItemHtml::loadHtml( const bool useCache, const QgsExpressionContex
jsLoop.execIfNotDone();
}
+#endif
recalculateFrameSizes();
//trigger a repaint