libreoffice-online/browser/html/debug.html
Julius Härtl 111856f289 Extract file_path from debug.html and pass other query parameters
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Change-Id: I48d22e08f1f312033d49d315489f2404e48e4dd7
2021-11-17 17:46:22 +01:00

39 lines
1.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Online</title>
<style>
html, body, iframe
{
margin: 0px;
padding: 0px;
border: none;
}
</style>
</head>
<body>
<form id="form" action enctype="multipart/form-data" target="coolframe" method="post">
<input name="access_token" value="test" type="hidden"/>
</form>
<iframe id="coolframe" name= "coolframe" style="width:100%;height:100%;position:absolute;">
</iframe>
<script>
function constructWopiUrl() {
var wopiUrl = window.location.protocol + "//" + window.location.host + window.location.pathname + "?";
wopiUrl = wopiUrl.replace("debug.html", "cool.html");
var params = new URLSearchParams(window.location.search);
var filePath = params.get('file_path').substr(1);
params.delete('file_path');
var wopiSrc = window.location.protocol + "//" + window.location.host + "/wopi/files/" + encodeURIComponent(filePath);
wopiUrl = wopiUrl + "WOPISrc=" + wopiSrc + '&' + params.toString();
return wopiUrl
}
var form = document.getElementById("form");
form.action = constructWopiUrl();
form.submit();
</script>
</body>
</html>