close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Open a new window on redirect

Thread began 6/14/2014 3:22 pm by derekmparker375520 | Last modified 6/17/2014 4:00 am by CraigR | 847 views | 7 replies |

derekmparker375520

Open a new window on redirect

I have a form set up that redirects the user to a different site after submitting the form. Is there a way to open this page in a new window?

Sign in to reply to this post

CraigRBeta Tester

PHP is server-side.

A new pop-up window is client-side.

Usually this is done with either the target="_blank" attribute in a link, or with javascript using window()

I suppose you could set your php redirect with a get parameter, and use this condition to trigger a script

<?php

if (isset($_GET['popup'] )) { ?>

<script>
window.open("page name", $other_attributes_here );
</script>

<?php } ?>

Sign in to reply to this post

derekmparker375520

Thanks for the reply. I'll give this a shot but I'm not sure where to put this in the code, could you help me out with that? I have the page attached to the previous post.

Sign in to reply to this post

CraigRBeta Tester

PM

Sign in to reply to this post

derekmparker375520

See PM

Sign in to reply to this post

CraigRBeta Tester

PM (if required)

If you change your form, so the redirect points to a new (internal) page, lets say external.php.

set the redirect url as follows... /external.php?popup=true

create a new page called external.php, add the following code within the <head></head> tags

<?php

if (isset($_GET['popup'])) { ?>

<script>
var win = window.open("http://google.com", '_blank');
win.focus();
</script>

<?php } ?>

changing the url to the one you need

This should work as long as the browser doesn;t have popups blocked

Sign in to reply to this post

derekmparker375520

That worked perfectly but there was only one problem. The issue is that the page containing the form (needs.php) has instructions for the site that they're redirected to. So I need the needs.php page to remain open so that they can reference that but it's showing external.php.

Sign in to reply to this post

CraigRBeta Tester

A couple of things spring to mind.

1. Instead of redirecting to a new internal page first, just redirect the page to itself, but include the url parameter in the redirect, then add the conditional javascript in the head section.

2. If this doesn't fulfil your needs, can you store whatever values you need in a session variable ?

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...