Hello!
I would like to open a new page from the button´s properties.
In HTML code this will be like this: "window.open(element.urlPage, '_blank');", but I don´t know how to do ir in wix.
Thank you!
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
Here's a workaround I made using HTML frames to open a URL in a new tab from velo:
https://youtu.be/7yp-kLGu1Yw
Hi Roger,
It is not possible to combine wixLocation.to with target=_blank.
First of all feel free to add a feature request here.
My suggestion is to use a repeater and design it like a table. In the email column add a button element with _blank as target.
Roi
I also need to open a link in a new window.
Using the element's:
element.target="_blank";
would seem to be the answer for a button or image or other element.
I am using dynamically created links based upon a client clicking the email column in a table. I can use:
wixLocation.to("mailto:" + customerEmail+ "?subject=Responding to your purchase order...");
This works great. It opens the email client, pre-filled with email address and subject, but in the same window. This forces the client to reload the database (and password screens) after sending the email.
Can I set the target property of wixLocation somehow to "_blank"?
Hi,
As far as I know, the options of opening in the same page, new window, new tab are browser settting and that there's really no method to code opening a URL in a new tab/window. I believe that there was at one time a standards proposal regarding this issue but so far it has not been approved.
Oh well 😞
Thank you!!
It´s its open the new url in the same page, and y would like to open it in new tab. It´s possible?
Thank you!
Hi,
As a preface to my answer...
WixCode understands all of Javascript, except for anything that accesses the DOM. This keeps the user from inadvertently "breaking" something. I myself tried to hack things from the code, from an iFrame, and in my dreams, but WixCode wasn't having any of it. Accessing document elements such as div, span, button, etc is off-limits. The way to access elements on the page is only through $w.
Now, with that in mind, what you need to do is to use wix-location. To navigate to a specific URL, use wix-location.to(). Here is an example how to navigate to an about page:
wixLocation.to("/about");
This should get you going in the right direction.
Have fun,
Yisrael