How can a forum post, open a link to a PDF, in a new window, without a Right-click?

Get help developing custom BBCodes or request one.
User avatar
Mike63740
Registered User
Posts: 124
Joined: Fri Feb 03, 2012 8:19 pm

Re: How can a forum post, open a link to a PDF, in a new window, without a Right-click?

Post by Mike63740 »

Code: Select all

This works wonderful:
[newtab=https://mysite.com]TEXT[/newtab]

Results: TEXT
Onclick, opens in new tab.
================================================
Something is wrong here:
[newtab]https://mysite.com]TEXT[/newtab]

Results: [newtab]https://mysite.com]TEXT[/newtab]
Onclick, opens in self.
I replaced ] with =, to make it work.


What am I doing wrong, or is this okay?

Thanks.
Open-source software has been changing lives since 1998.
User avatar
warmweer
Jr. Extension Validator
Posts: 11234
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Re: How can a forum post, open a link to a PDF, in a new window, without a Right-click?

Post by warmweer »

Mike63740 wrote: Fri Feb 03, 2023 1:13 pm
Something is wrong here:
[newtab]https://mysite.com]TEXT[/newtab]
You've got an extra ] there
[newtab=https://mysite.com]TEXT[/newtab]

edited: as I had coloured the wrong ]
Last edited by warmweer on Wed Mar 15, 2023 7:45 am, edited 1 time in total.
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
Mike63740
Registered User
Posts: 124
Joined: Fri Feb 03, 2012 8:19 pm

Re: How can a forum post, open a link to a PDF, in a new window, without a Right-click?

Post by Mike63740 »

1. I am using the exact bbcode posted by, HiFiKabin.

2. Post text: https://mysite.com

3. I selected the entire domain address.

4. I then clicked on HiFiKabin bbcode (newtab).

5. Results/Appearance: [newtab]https://mysite.com[/newtab]

It opens in self.
Last edited by Mike63740 on Fri Feb 03, 2023 7:56 pm, edited 2 times in total.
Open-source software has been changing lives since 1998.
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 6671
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: How can a forum post, open a link to a PDF, in a new window, without a Right-click?

Post by HiFiKabin »

The code I posted works perfectly as you can see HERE
User avatar
Mike63740
Registered User
Posts: 124
Joined: Fri Feb 03, 2012 8:19 pm

Re: How can a forum post, open a link to a PDF, in a new window, without a Right-click?

Post by Mike63740 »

HiFiKabin’s bbcode:

BBCode usage:

Code: Select all

[newtab={URL}]{TEXT}[/newtab]
HTML replacement:

Code: Select all

<a href={URL} target="_blank">{TEXT}</a>
Help line:

Code: Select all

Open in New Tab
============
Post text only: https://mysite.com

Results/Appearance: https://mysite.com

Opens in self.
============
Edited post text with HiFiKabin’s bbcode:

1. I selected the entire domain address.

2. I then clicked on HiFiKabin's bbcode (newtab).

3. Results/Appearance: [newtab]https://mysite.com[/newtab]

It opens in self.
Open-source software has been changing lives since 1998.
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 6671
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: How can a forum post, open a link to a PDF, in a new window, without a Right-click?

Post by HiFiKabin »

The correct way to use this BBCode is as follows

Code: Select all

[newtab=https://mysite.com]My Site[/newtab]
Mike63740 wrote: Fri Feb 03, 2023 8:52 pm Post text only: https://mysite.com
From the above it seems that you are not using it correctly

Please show a screenshot of the BBCode in the ACP. I know the code I supplied is working correctly as it is working on my site. Did you check the link I provided?
screenshot_39.png
User avatar
Mike63740
Registered User
Posts: 124
Joined: Fri Feb 03, 2012 8:19 pm

Re: How can a forum post, open a link to a PDF, in a new window, without a Right-click?

Post by Mike63740 »

This issue was solved:
Mike63740 wrote: Fri Feb 03, 2023 1:13 pm

Code: Select all

This works wonderful:
[newtab=https://mysite.com]TEXT[/newtab]

Results: TEXT
Onclick, opens in new tab.
================================================
Something is wrong here:
[newtab]https://mysite.com]TEXT[/newtab]

Results: [newtab]https://mysite.com]TEXT[/newtab]
Onclick, opens in self.
I replaced ] with =, to make it work.


What am I doing wrong, or is this okay?

Thanks.
This issue was better than solved:
Mike63740 wrote: Fri Mar 10, 2023 7:08 pm Perfect:
Brf wrote: Tue Feb 28, 2023 7:29 pm Instead of doing that, upload the pdfs as attachments in posts.
By adding a PDF as an attachment, there is no need for BBCodes, or anything else.

Because when the attachment link, to the PDF (Info.pdf) is clicked, it links to: (https://mysite.com/phpBB/download/file.php?id=9).

It opens a dialog box in the upper right-hand corner.

It gives the user the option to Open the PDF, in a new window, or Save as, to the computer.

If a user is signed out, bookmarks will not work.

This is good for opening in a new window, with more options, and better security.

Thank you.

P.S. Since March 2, 2023 to active:
1. Moved mysite.com to a new domain registrar.
2. Transferred mysite.com to a new web hosting service.
3. Rebuilding mysite.com from backups.
Open-source software has been changing lives since 1998.
Post Reply

Return to “Custom BBCode Development and Requests”