Running embedded Javascript from a URL (adwords landing page)

I have Javascript in the title of my site (Opencart), which scrolls the page to three product options, selected from the drop-down menu at the top of the category pages.

function getBatt() {
  var myselect = document.getElementById("batt");
  var battery = myselect.options[myselect.selectedIndex].value;
  document.getElementById(battery).scrollIntoView();
}

I want to run this script from the landing page URL in my adwords ad to display the three product options on the category page, instead of directly navigating to the product page that would only display one product option. This should create a better user interface.

(For example, an announcement for a bl-4b product, the destination address is xxx / NOKIA BATTERIES. Instead of forcing the user to manually select the product from the drop-down menu, I want to pass the bl-4b (batt) parameter to the function and run it when the page loads. )

Is this possible / practical without opening a can of worms in terms of security?

+4
source share
1 answer

You can create one URL, a URL with one parameter for each product, for each advertisement, and then get the parameter using javascript and go to that product.

0
source

Source: https://habr.com/ru/post/1610067/


All Articles