0

My question might seem a bit ambiguous but you should understand what I mean first.

I want to be able to generate dynamic URLs on the fly so that when a link (x link) is clicked on a parent page, it should move to a 'node' page which then decides to move to the 'x' page corresponding to the link clicked on the parent page.

For e.g. -

  1. Parent page has 5 links (a, b, c, x, y)
  2. User clicks on 'b'
  3. User is led to Node Page which plays a video and automatically (after the video ends) redirects to Page 'b' (js to simulate click below)

Is there a mechanism where the Node page can detect the link clicked on the parent page and lead the user to the corresponding page ID defined on the parent page? See Image below - enter image description here

I already have implemented the automatic progression from the Node page using JS below which leads the user to the next page after 15.5 seconds -

<script>
    $("document").ready(function() {
        setTimeout(function() {
            $(".proceed").trigger('click');
        },15500);
    });
</script>

What I need to know is that based on the link clicked on the parent page, can the Node Page decide where to lead the user next?

Also, this HTML package is to be used on an e-detailing platform running on iOS for the iPad which in my experience allows most of HTML, CSS & JS/jQuery.

Thanks in advance

1
  • Pass a query string to Node page from parent page and define which page to redirect from query string after video played. Commented Jan 19, 2016 at 12:18

3 Answers 3

1

Try something like that

<a class="mylink" data-url="a.html">A</a>
<a class="mylink" data-url="b.html">B</a>

<script>
var url = "";
$(".mylink").click(function(){
url=$(this).data("url");

//Here your function who start your video
playvideo();
});

//Here function trigger when your video is finish
function videoIsFinish()
{
   if(url!="")
      window.location.href=url;

}

</script>
Sign up to request clarification or add additional context in comments.

Comments

0

This is very much doable. Just use a javascript switch statement (see here) and pass the case value using the url the user clicks (see here).

Have the switch statement on the node page that can then pass you on to the desired destination page using JavaScript.

Comments

0

This can be easily achievable, first you can use any global variables and then assign the value to the variable.

var url = window.location.href;

Then on the node page you can check the value of the url variable, navigate to the page according to that. Other solution is you can use document.referrer to get the previous url. Then do the same checking according to it.

var url = document.referrer;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.