RM: Ajax Preload

This commit is contained in:
Tony Air 2024-06-21 22:21:31 +02:00
parent fd72eb62e7
commit a4d463e99d

View File

@ -241,8 +241,8 @@ class DeferredRequirements implements TemplateGlobalProvider
}
unset($fonts, $font);
$preloadPath = Controller::curr()->Link().'?ajax=1';
$html .= '<link rel="preload" as="fetch" href="'.$preloadPath.'" />'."<script>fetch('".$preloadPath."', {method:'GET',credentials:'include',mode:'cors'}).then((r)=>{return r.json()}).then((d)=>{window.preloadedData = d})</script>";
/*$preloadPath = Controller::curr()->Link().'?ajax=1';
$html .= '<link rel="preload" as="fetch" href="'.$preloadPath.'" />'."<script>fetch('".$preloadPath."', {method:'GET',credentials:'include',mode:'no-cors'}).then((r)=>{return r.json()}).then((d)=>{window.preloadedData = d})</script>";*/
return $html;
}