Jump to content

Opening Page in New Window

Recommended Posts

Hi there,

I've written a script for a custom button to be added under my product page. However, I want the whatsapp url to be open in a new window upon clicking on the button.

Below is the script I've written:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
   <script>
   $(function() {
     $("<a class='whatsappbtn' href='https://api.whatsapp.com/send?phone=6588747658'> Whatsapp Us! </a>").insertAfter(".sqs-add-to-cart-button-wrapper");        
   });
</script>

 

Hope to get some help, thank you!

Link to comment
  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Hi. Use new code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
   <script>
   $(function() {
     $('<a class="whatsappbtn" href="https://api.whatsapp.com/send?phone=6588747658" target="_blank"> Whatsapp Us! </a>').insertAfter(".sqs-add-to-cart-button-wrapper");        
   });
</script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment

Thanks a bunch! I'm also looking to add a custom facebook icon on my product page. I'm currently having problem with adding the facebook image. Below is my code:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
   <script>
   $(function() {
     $("<a class='facebookbtn' href='https://facebook.com' img src='http://simpleicon.com/wp-content/uploads/facebook.png'>Facebook</a>").insertAfter(".sqs-add-to-cart-button-wrapper");        
   });
</script>

Mind helping with this as well? haha

Link to comment
4 hours ago, Lestor said:

Thanks a bunch! I'm also looking to add a custom facebook icon on my product page. I'm currently having problem with adding the facebook image. Below is my code:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
   <script>
   $(function() {
     $("<a class='facebookbtn' href='https://facebook.com' img src='http://simpleicon.com/wp-content/uploads/facebook.png'>Facebook</a>").insertAfter(".sqs-add-to-cart-button-wrapper");        
   });
</script>

Mind helping with this as well? haha

You mean add both fb + whatsapp on same position?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
On 5/29/2021 at 10:40 AM, Lestor said:

Yup two buttons side by side. But for the fb, I want to use the facebook image icon instead of just a button

Try this code, if it doesn't work, can you share link to a product, we can check easier

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.2/css/all.css" integrity="sha384-vSIIfh2YWi9wW0r9iZe7RJPrKwp6bG+s9QZMoITbCckVJqGCCRhc+ccxNcdpHuYu" crossorigin="anonymous">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
   <script>
   $(function() {
     $('<a href="https://facebook.com"><i class="fab fa-facebook-square"></i></a><a href="https://api.whatsapp.com/send?phone=6588747658"><i class="fab fa-whatsapp"></i></a>').insertAfter(".sqs-add-to-cart-button-wrapper");        
   });
</script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
On 5/29/2021 at 10:40 AM, Lestor said:

Yup two buttons side by side. But for the fb, I want to use the facebook image icon instead of just a button

Let me know if the code work or not ❣️

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.