Javascrip in Preparation to Browser (Change Tab)

Hello, I have a javascript that is being loaded in preparation using an action called RunJavaScript.This action gets JavaScript code to be sent to the browser. However this script is only loading sometimes. For example when I change menu tab and then go back to the initial one the javascript is no longer loading.I needed it to be loaded always. Any ideas on alternatives?

Solution

Hey Ines,

If javascript has variable parameters, you can load it via web-block, otherwise you can put it in your own Javascript page.

I think this will solve your problem.

Solution

Hi Inês,

When you say you are "going back", do you mean using the "back" button of the browser?

In this case, the most probable is that the Browser is using a "cached" version of the page, and this may be the reason why the JavaScript is not running again.

If so, adding a Web Block with the JavaScript set in the JavaScript Property of it may solve your problem indeed.

If you need to access page elements, you can also consider setting the JavaScript into an expression, setting the Excapte Content property of the expression to "No".

In this case, the JavaScript text should be put into the expression like this:

"<script> put here the JavaScript code </script>"

Cheers.

Hi Inês,

When you change tab the preparation is not running again.

This should be the reason why your javascript is not passing the new values.

Ana Oliveira wrote:

Hey Ines,

If javascript has variable parameters, you can load it via web-block, otherwise you can put it in your own Javascript page.

I think this will solve your problem.

Hello Ana,

Very thanks. It is already working.