Merge pull request #689 from znerol-forks/feature/cowebsite-load-map-relative-url
Allow URLs relative to map base in iframe / openWebsite
This commit is contained in:
commit
bf8e8bf777
@ -654,7 +654,7 @@ export class GameScene extends ResizableScene implements CenterListener {
|
||||
coWebsiteManager.closeCoWebsite();
|
||||
}else{
|
||||
const openWebsiteFunction = () => {
|
||||
coWebsiteManager.loadCoWebsite(newValue as string, allProps.get('openWebsitePolicy') as string | undefined);
|
||||
coWebsiteManager.loadCoWebsite(newValue as string, this.MapUrlFile, allProps.get('openWebsitePolicy') as string | undefined);
|
||||
layoutManager.removeActionButton('openWebsite', this.userInputManager);
|
||||
};
|
||||
|
||||
|
@ -42,7 +42,7 @@ class CoWebsiteManager {
|
||||
this.opened = iframeStates.opened;
|
||||
}
|
||||
|
||||
public loadCoWebsite(url: string, allowPolicy?: string): void {
|
||||
public loadCoWebsite(url: string, base: string, allowPolicy?: string): void {
|
||||
this.load();
|
||||
this.cowebsiteDiv.innerHTML = `<button class="close-btn" id="cowebsite-close">
|
||||
<img src="resources/logos/close.svg">
|
||||
@ -55,7 +55,7 @@ class CoWebsiteManager {
|
||||
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.id = 'cowebsite-iframe';
|
||||
iframe.src = url;
|
||||
iframe.src = (new URL(url, base)).toString();
|
||||
if (allowPolicy) {
|
||||
iframe.allow = allowPolicy;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user