Jump to content

Redirect Current Page and Open Popup window


Nightasy
Go to solution Solved by Nightasy,

Recommended Posts

Greetings all,

 

I have a bit of challenge that I don't know exactly how to solve. What I am trying to do is open a popup window using javascript and also redirect the page that has the original link on it to a new page. Basically what I want to happen is, user clicks on link, page redirects and a popup window opens at the same time.

 

Sort of like having two links in one.

 

Here's what I tried. It didn't work.

echo '
			<a href="sectvideo.php?sect=' . $row[0] . '">
			' . "<a href=\"javascript:create_window('".$row[1]."',640,360)\">" . '
			<div id="historyUniqueWrap">
			<div id="historyUniqueImage">
				<img src="'. $row[2] .'"/>
			</div>
			<div id="historyUniqueTitleMessageWrap">
			<div id="historyUniqueTitle">
				<h4>Section: ' . $row[0] . " >>" . '</h4>
				<p>' . stripslashes($post1). "..." . '</p>
			</div>
			</div></a></a>

Any ideas?

 

Best Regards,

Nightasy

 

Edit: I just had an idea, I could set a condition to be met in the page that is being linked to using a GET. That would solve this issue. I'll try that and report back if it works or not.

Edited by Nightasy
Link to comment
Share on other sites

Alright, so I tried to set up the other page to create the popup when it loads if the GET variable is set. Unfortunately this did not work.

 

Here is what I placed on the other page.

if(isset($_GET['vidhist'])){
?>
<script type="text/javascript">
    create_window(<?php echo $_GET['vidhist']; ?>,640,360);
</script>
<?php
} ?>

The javascript is not working when the page loads. It should create a pop up window.

Link to comment
Share on other sites

  • Solution

I got it working. I had to add the javascript to an onload function.

 

Turned out like this.

<?php
if(isset($_GET['vidhist'])){
?>
<script type="text/javascript">
 onload = function() {
    create_window(<?php echo '"' . $_GET['vidhist'] . '"'; ?>,640,360);
	};
</script>
<?php } ?>
Edited by Nightasy
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.