vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Miscellaneous Hacks - Open Internal Links in Same Tab - Ported by BOP5 (VB 4.x & VB 3.x) (https://vborg.vbsupport.ru/showthread.php?t=286348)

BirdOPrey5 08-04-2012 10:00 PM

Open Internal Links in Same Tab - Ported by BOP5 (VB 4.x & VB 3.x)
 
1 Attachment(s)
Brought to you by BirdOPrey5.

NOTE: If you already use jquery on all pages see this mod instead: https://vborg.vbsupport.ru/showthread.php?t=286030

The purpose of this mod is to automatically turn any "internal" links into links that open in the same window (or tab) instead of always opening in a new window. By default all links added with the[URL] BBCode in vBulletin become links that open in new windows. This uses JavaScript to automatically fix this.

You can add multiple domains in the settings to be treated as "internal" domains. If you don't add any it will try to atuomatically detect the domain being used.

Note: If you add *any* domains then you must specify all local domains, it will not try to auto-detect.

Mod becomes active upon installation. Go to Admin CP -> Settings -> Options -> Open Internal Links in Same Window... to enable/disable mod and edit the domain(s) considered local.

If the user is browsing with JavaScript disabled then links will always open in a new window like is the usual behvior.

Live Demo: Demo Link

Should be compatible with all vBulletins between 3.6.0 and 5.0.0. (So all 3.8.x and 4.x.x for sure.)

Has been tested and found compatible with all current major browsers: IE9, FF 13 & 14, Chrome, Opera, and Safari.

I need to thank 2 others for this mod:

djbaxter on vBulletin.org and his similar mod.

His mod does something similar but is jquery based. This makes the JavaScript code simpler but requires the jquery library be loaded on every page load. vBulletin doesn't use jquery on most pages so that could add significantly to loading times.

And...

Alen Grakalic who posted an original JavaScript on Css Globe: Open External Links in New Window Automatically | Css Globe
I modified this publicly available code to have it work with vBulletin and allow for multiple local domains, however a lot of the code bign used remains his.

So thanks to djbaxter for the idea and Alen for a great jump-start on the code (I'm not a big fan of JavaScript ;))

------------------------------------------------------

Please "Mark as Installed" if you use this. :)
Nominate MOTM if you LOVE it! ;)

BirdOPrey5 08-05-2012 01:29 PM

Reserved.

bzcomputers 08-06-2012 04:26 AM

Adding an option to force external links (all other domains you don't list) to open in a new tab would be convenient.

BirdOPrey5 08-06-2012 11:32 AM

Quote:

Originally Posted by bzcomputers (Post 2354891)
Adding an option to force external links (all other domains you don't list) to open in a new tab would be convenient.

How? The links already open in new tab if you don't use this? :confused:

Justinphx 08-06-2012 12:09 PM

Very nice BOP5. I installed on 4.1.12p2 and works perfectly. This is very useful in the mod and admin forums where internal links are always being posted. Having them open in the same window was a great idea.

bzcomputers 08-06-2012 05:06 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2354942)
How? The links already open in new tab if you don't use this? :confused:

This is not my experience. For me any external link (unless tagged with "_blank") will open in the same tab taking the user away from your website.

BirdOPrey5 08-06-2012 06:29 PM

Where are these external links? If they are custom links you created yourself then I would expect you use _blank f you wanted to?

I guess I wasn't figuring there wold be any external links not custom created or created by bbcode.

I will see what I can do but would like to see an example for sure.

BadgerDog 08-07-2012 10:59 AM

Installed on vBulletin 4.1.3pl5 with thanks ... :)

Seems to work great ... :up:

Regards,
Doug

kfyonur 08-08-2012 06:55 AM

how can i open audiclubtr.com/anasayfa links in new tab ?

http://www.audiclubtr.com/f26/audi-t...uyuruldu-2246/

BirdOPrey5 08-08-2012 10:52 AM

If audiclubtr.com is your domain then you can't. If you need to open internal links in new tabs, don't use this mod.

k6rikko 08-23-2012 12:13 AM

Many thanks was looking days for an solution like this :)

bzcomputers 08-23-2012 03:34 AM

Quote:

Originally Posted by BirdOPrey5 (Post 2355035)
Where are these external links? If they are custom links you created yourself then I would expect you use _blank f you wanted to?

I guess I wasn't figuring there wold be any external links not custom created or created by bbcode.

I will see what I can do but would like to see an example for sure.

I am opening a specific forum up to advertising and wanted any external links posted within that forum to open in a new tab.

BirdOPrey5 08-26-2012 11:47 AM

External links will always open in a new tab with or without this mod installed.

DemOnstar 09-04-2013 12:33 PM

From the the articles page https://www.mightymoiety.com/content.php?117-lifestyle, as an unregistered user I click the link https://www.mightymoiety.com/forum.php in the (If is your first visit) notice but it is still opening up in a new tab.. The mod is enabled..

Is there a setting somewhere?

Ta.

ozzy47 09-04-2013 12:42 PM

How have you added that banner where the links are at?

ozzy47 09-04-2013 12:49 PM

I see it is probably the default_guest_message in Notices. So you go to the ACP --> Notices --> Notices Manager, click on edit for the default_guest_message

In the field Notice HTML find all instances of _blank and change it to _self

DemOnstar 09-04-2013 01:17 PM

Quote:

Originally Posted by ozzy47 (Post 2443150)
I see it is probably the default_guest_message in Notices. So you go to the ACP --> Notices --> Notices Manager, click on edit for the default_guest_message

In the field Notice HTML find all instances of _blank and change it to _self

Genius.

You guys............................

Sorted :cool:

ozzy47 09-04-2013 01:30 PM

Not a problem, glad to help. :)

jaffaman 10-15-2013 03:14 PM

Thanks for this installed and working on 4.2.2

Vintum 01-07-2014 02:24 AM

I can't get this to work. Did I misunderstand it? I want to open all outside links in new tabs, but everything continues to open in the same one. I have tried adding:
domain.com
forum.domain.com
nothing at all
And all 3 options still left links opening in same page.

Using 4.2.2.

BirdOPrey5 01-07-2014 11:35 AM

Can you post or PM link to your forum?

ozzy47 10-15-2014 01:00 AM

Joe I am working on a mod, that has banners in a block. I redirect the user to

HTML Code:

ozzmodz_link.php?goto={vb:raw sitelink.site_url}&siteid={vb:raw sitelink.site_id}
when they click on the banner. What this does is increase the click count for each banner, then redirects the user to the requested site.

Each banner can be set to self or blank. But with your script running it of course opens in the same tab only. How can I over ride that?

BirdOPrey5 10-15-2014 09:07 AM

There really is no way around it as the mod is coded.

I suppose you could add a check to see if the element is part of an "ignoreme" class and if so, ignore it.

Feel free to release a new version if you wish, it is re-usable code.

ozzy47 10-15-2014 10:32 AM

Yeah that is a bit beyond my skills, but I guess I can search around.

BirdOPrey5 10-16-2014 08:05 AM

Yeah- Not really in mine either... I hate JavaScript. This mod only has 30 installs, wouldn't worry about compatibility too much.

stangger5 02-27-2023 09:51 PM

Installed on vb4.2.5, I don't see the admincp option to add domain.

Hostboard 02-28-2023 01:19 PM

It is just easier to edit a file:

https://vborg.vbsupport.ru/showpost....7&postcount=17


All times are GMT. The time now is 01:09 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01201 seconds
  • Memory Usage 1,775KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (27)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete