Execute Javascript with BackButton

L Leo Leo 3 years 6 months ago
3 0 0

Hi everyone,

We are currently working on a Rhomobile Project and we are in front of a problem.
Let me explain. In a page, we want to execute a JavaScript function by clicking on the back button. It works for the first time, showing an alert like "ok it works". But the second time we click on it, it doesn't open the JavaScript function at all. Worst, it redirects us on the previous page !

We just want the JavaScript to execute without any redirections.
Here is our code so far:
def personalisee      render :back => 'callback:' + url_for(:action => :callback_alert)    end        def callback_alert      Rho::WebView.executeJavaScript("backButton();")    endwhere personalisee is our controller and callback_alert, the function we want to call by clicking on the back button

function backButton(){  alert("works!");}
We will really enjoy any solutions or even small hacks.
Thank you for your answers!

Leo

CONTACT
Can’t find what you’re looking for?