Viewing 12 replies - 1 through 12 (of 12 total)
  • The function of this plugin is to send emails and not for domain redirect. Your topic is completely out of subject matter of this plugin…

    Additionally, you can create a drop-down list consisting with all your sub domains such that visitors can select the appropriate site click “GO” to visit! I hope that will be easier to implement.

    Thread Starter Haim

    (@koostamas)

    Thanks biswajeet!

    Oké… I understand…
    Well, the domain, where I want to send my visitors, has many subdomains (many tenthousands), and they are created all the times automatically.

    So, I really need the input from my visitor…

    I keep on looking for a solution!
    If you know any other solution… I would be glad to learn it!

    Anyhow, Contact Form 7 is a great plugin… for other things. And I am using it, too. ??

    Greetings,

    Tamás

    If you want to create the domain name from visitor input and redirect then as follows –

    1. create the input form

    <form id="domain_redirect" action="" method="">
    <p>
    <label for="domain">Enter domain:</label><br />
    <input type="text" id="domain" name="domain">
    </p>
    <p>
    <input type="submit" name="submit" value="Go visit">
    </p>
    </form>

    2. You can redirect with two approach – PHP or JavaScript

    JavaScript code

    jQuery('form#domain_redirect').submit(function(e) {
     e.preventDefault();
     var webRoot = 'example.com';
     var domain = jQuery('input#domain').value();
     if( domain != '' ) window.location.href = 'https://'+'domain.'+webRoot;
     else alert( 'Please enter a valid domain' );
    });

    Further, if you want to create the domain dynamically as per visitor type and then redirect, on that case I think PHP approach will be the best option.

    This is the basic idea and you can further do a whole lot of things to suite as per your needs. This type of custom requirement needs developer works. I hope this will help you a bit…

    Thread Starter Haim

    (@koostamas)

    Thanks!

    I am testing it in a separate html file:
    https://yagooft.pl/tamas-test/url-test.html

    The form is there… however, it does not jump…

    I made some small modification… I know very few of jQuery, … Just … may be here is something to be changed?

    window.location.href = 'https://'+'domain.'+webRoot

    THANKS thousand times.

    Tamas

    **Important: It is seen that you have not included jquery library. You must include it in the head section above otherwise it will not work!**

    Hi, either you should put the above javascript block as it is just below the form or wrap it inside

    jQuery(document).ready(function() {
    
     //put the above code here
    
    });

    if you put under head section.

    fix:
    window.location.href = 'https://'+domain+'.'+webRoot;

    best of luck!

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    You must include it in the head section above otherwise it will not work!

    Very true, but if you do want to use jquery in WordPress, please consider using wp_enqueue_script().

    Thread Starter Haim

    (@koostamas)

    Thanks biswajeet and Jan!

    I am not an expert at all (understatement… I do not know it at all!)

    So, PLEASE… give me the exact code and the exact palce where to put it?
    And how…

    THANKS, again!

    Tamas

    Edit: tamas-test/url-test.html replace with these code completely. Just copy paste and check it out…

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "https://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    
      <meta content="text/html; charset=UTF-8" http-equiv="content-type">
      <title>Go to URL test</title>
      <script src="https://yagooft.pl/wp-includes/js/jquery/jquery.js?ver=1.7.2" type="text/javascript"></script>
    
      <script type="text/javascript">
    jQuery(document).ready(function($) {
    
      $('form#subdomain_redirect').submit(function(e) {
      e.preventDefault();
      var webRoot = 'yagooft.com';
      var domain = $('input#subdomain').value();
      if( domain != '' ) window.location.href = 'https://'+domain+'.'+webRoot;
      else alert( 'Please enter a valid domain' );
      });
    
    });
     </script>
    </head>
    
    <body>
    <form id="subdomain_redirect" action="" method="">
      <p><label for="subdomain">Enter sub-domain:</label><br>
      <input id="subdomain" name="subdomain" type="text"> </p>
      <p> <input name="submit" value="Go visit" type="submit"></p>
    </form>
    <br />
    
    </body>
    </html>

    Thread Starter Haim

    (@koostamas)

    Here it is:
    https://yagooft.pl/tamas-test/url-test.html

    And it … does nothing for me.
    Neither when the box is left empty (no alert message), nor when I type in a subdomain name.

    What is next? ??

    THANKS a LOT!!!!!!!!!!!

    T

    Hi it will definitely works!

    Typo mistake: var domain = $('input#subdomain').val();

    just correct it.

    Thread Starter Haim

    (@koostamas)

    YES!!!! It works now!!!

    Thanks, biswajeet
    ??

    Now… integration into WP!

    “…if you do want to use jquery in WordPress, please consider using wp_enqueue_script().”

    Thanks, Jan Dembowski… How to integrate?

    Thread Starter Haim

    (@koostamas)

    Yes! It works now in the WP site, as well.
    It is in a widget, with the help of a plugin:
    HTML Javascript Adder
    by Aakash Chakravarthy

    See on the right side, under the QR code at
    yagooft.hu

    Thanks, biswajeet!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Plugin: Contact Form 7] Go to a website URL typed in by the visitor’ is closed to new replies.