user tip opening a tab in a new window

Deb W.
Deb W.
@deb-w
8 years ago
136 posts
I'm using site builder to make most of the set up on my site. I have a menu tab that, when clicked on, opens another website. It works great except that I would like it to open in a new window instead of exiting my JR site. Can I do that? If so, how?
updated by @deb-w: 03/22/17 03:21:03PM
paul
@paul
8 years ago
4,331 posts
Select the SiteBuilder menu item then in its 'OnClick Code' field enter this -

window.open('http://www.google.com');

Changing 'http://www.google.com' to whatever your URL is, of course.
Then make the URL field blank.
hth


--
Paul Asher - JR Developer and System Import Specialist
Deb W.
Deb W.
@deb-w
8 years ago
136 posts
Worked great! Thank you.
joanna
@joanna
8 years ago
88 posts
Thank you for this tip. :)
It works perfectly.

Jamroom team, as usual, is awesome.
joanna
@joanna
8 years ago
88 posts
I've just noticed a challenge, and now I wonder what I did wrong.
When someone clicks on the tab or subtab a new window is open, but the page when a member was is redirected to the home page. It would be great if that page will not change.
Deb W.
Deb W.
@deb-w
8 years ago
136 posts
I did that at first too. You need to leave the regular URL field blank. see attached
updated by @deb-w: 10/27/16 11:26:18AM
joanna
@joanna
8 years ago
88 posts
The regular URL is blank.
I checked all tabs and subtabs.
I cleared the cache.
And still, the page where I was is redirected to the home page.
And now I wonder what I did wrong.
updated by @joanna: 10/27/16 11:35:27AM
Deb W.
Deb W.
@deb-w
8 years ago
136 posts
Did you have the exact page you want them directed to listed in the OnClick Code box, complete with the single quote marks? It should look like this:

window.open('http://yoursite/page/whatever')

otherwise, I don't know what is the issue... sorry! It worked for me - One of our main tabs actually directs the member to another website outside our JR site.
joanna
@joanna
8 years ago
88 posts
A mistunderstanding ...

I was talking about the page where I was, I want it stay open because I want to come back there.

For example, I'm in a Forum. I click on a tab, and it redirects me to the page which I want. (This works perfectly). But in the same time, the Forum page redirects itself to the home page. But I want the Forum page stays open, I want to come back there soon.

I hope now I sound clearer.
Deb W.
Deb W.
@deb-w
8 years ago
136 posts
Joanna - You are definitely clearer... and now you've pointed an issue I didn't even know I had! My site does the same thing. Hmmm... I have no idea but would love to hear if anyone else has a solution.

Deb
paul
@paul
8 years ago
4,331 posts
Instead of leaving the URL field blank, put a hash (#) in it. That should fix things.
hth


--
Paul Asher - JR Developer and System Import Specialist
joanna
@joanna
8 years ago
88 posts
Hi Paul
Sorry, it didn't help. The page is still redirected to the home page.
paul
@paul
8 years ago
4,331 posts
You took my instructions literally ;-)

# not (#)


--
Paul Asher - JR Developer and System Import Specialist
joanna
@joanna
8 years ago
88 posts
It was the second version because when I put # it didn't work. Then I tried to do it literally.
Deb W.
Deb W.
@deb-w
8 years ago
136 posts
paul:
You took my instructions literally
# not (#)

ditto. I just put # without the ( ) and it didn't work.
michael
@michael
8 years ago
7,746 posts
try:
window.open('http://www.google.com');return false;
joanna
@joanna
8 years ago
88 posts
Cool!
Thanks @Michael, it works. :)