Jump to content

Redirect Current Page and Open Popup window


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.

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.

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 } ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.