Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7173323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:48:02+00:00 2026-05-28T15:48:02+00:00

How do I run a script on a page only if the page was

  • 0

How do I run a script on a page only if the page was opened from another page?

I have this page element:

    <div id="Devotion_alert"></div>

I add a span with onclick to that div.

    var show_devotion_alert = '<span style="cursor:pointer;" onclick="open_livemass();"><br/>'+devotion_name+' '+time_info+'<br/>('+devotion_channel.name+')</span>';
    $('#Devotion_alert').html(show_devotion_alert);

When the user clicks on the element I want to run a script:

function open_livemass() {
    window.location.href = 'livemass_RECORDED.php';
    // want to select elements on the new page and load element content
}

When the new page loads I want to select page elements and load element content. I only want to do that if the new page was opened with a mouseclick from the previous page.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:48:03+00:00Added an answer on May 28, 2026 at 3:48 pm

    OK. Found that the most practical solution was to send variables in the URL to tell the new page what to do. If the variables are not there, the page will be the same as if it were opened directly. If the variables are there, a javascript function will load the page elements.

    From the referrer page onclick I open the new page with this:

        window.location.href = 'livemass_RECORDED.php?show_next='+show_next+'&idx='+idx;
    

    In the livemass_RECORDED.php page I read the variables and fill the necessary elements.

    <?php 
        $show_next = $_REQUEST['show_next'];
        $channel_idx = $_REQUEST['idx'];
    ?>
        <script>
            var show_next = "<?php echo $show_next; ?>";
            var channel_idx = <?php echo $channel_idx; ?>;
            alert (' LIVEMASS show next '+show_next+' channel '+channel_idx);
            if ( show_next.search(/Devotion/i) != -1 ) {
            }
            else if ( show_next.search(/Mass/i) != -1 ) {
            }
        </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to run some JQuery script on a particular page but only
I have a jquery script which I need to run only once everything else
I have a need to dynamically include and run a script in a page.
When I run the following script, the event always fires on page load. I
When does script added to the page with Page.ClientScript.RegisterStartupScript() actually run? MSDN states "when
I typically run a script each night that updates my code from SVN, then
I need to run a script and have access to the default stdin (terminal
I have a div with a partial inside somewhere on the page. I have
This is weird. Only on mobile safari, and since last night this script.... function
Scenario: I have a php page in which I call a python script. Python

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.