Post and redirect


#1

Hello,

I would like to integrate a Gdevelop game into a web page that needs to be redirected based on the game’s choices.
The game is inside a form, in “vanilla” javascript I used a script that creates a button with the data and clicks on it. But in GDevelop i’m newbie and it doesn’t seem to work.
I tried the “send a request” extension which, understandably, sends the data without redirecting the page.
Is there any way to do this?


#2

Hi,
If the page displaying the game changes, the game is exited, right? :thinking:


#3

Sure, page change and close the game, no problem for this.


#4

GDevelop allows to use javascript snippets, so you should be able to make that redirect work.
See http://wiki.compilgames.net/doku.php/gdevelop5/events/js-code#javascript_code_events
and
https://stackoverflow.com/questions/48487739/window-openurl-self-not-working


#5

Sure. I had already tried to integrate the js code but the game crashes when I run it …
The code (I am attaching it) works when used alone.
screen


#6

Can’t help you much with javascript, I’m afraid, but have you checked ctrl+shift+i? The console tab is sometimes helpful with crashes.