Message from JavaScript discussions

October 2020

— So you don't get parallel fetching anyway

— 

Yeah, I want to have the http2 advantages for modern browsers but still need a running system for ie11 as well. And preload still doesnt work in firefox as well - at least not OOTB

— Well firefox will probably eventually enable support for it

— I am trying to find a solution that works in all browsers and still can take advantage of http2 for modern browsers

Message permanent page

— Probably not possible with dynamic scripts

— I mean, I guess you could just request the urls of the static scripts early using XMLHttpRequest or something

Message permanent page

— And make sure to have cache headers?

— Or with HTTP2 server can just push the scripts, so it doesn't really matter when you set the script tag

Message permanent page

— True, but I am already thinking about dropping the main optimization which caused all the other issues. I just wanted to have target based bundles for the custom js code, but that fucked up all the legacy stuff as my scripts are dynamically added based on feature detection

Message permanent page

— I want to trigger php function using javascript but not working

— Can you share the code in plain text? using pastebin or hastebin

— <?php
function change(){
header("location: register.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box {
height: 100px;
width: 100px;
background-color: green;
}
</style>
</head>

<body>
<div class="box" onclick="my()">
<button>Click me</button>
</div>

<script>
function my() {
var trigger = <?php change(); ?>
}
</script>
</body>
</html>

Message permanent page