1
Xman04
How do I prevent linked site pages from opening in a new window?
  • 2006/5/20 22:34

  • Xman04

  • Not too shy to talk

  • Posts: 180

  • Since: 2004/7/12


Hi,

When a user opens a notification's message, the following message format appears:

Quote:
Hello ......,

A new article "............" has been added at ........com.

You can view this article here:
http://www......com/modules/..../article.php?storyid=14

-----------

You are receiving this message because you selected to be notified when new articles are added to our site.

If this is an error or you wish not to receive further such notifications, please update your subscriptions by visiting the link below:
http://www........com/notifications.php

Please do not reply to this message.

etc, etc.


The problem is that when the article or notifications links are clicked, the article page or notification settings page opens up in a new browser window. I would like them to open within the same window, since I really don't think it should behave like a popup screen (especially since it is linking pages within the site). I've noticed this same issue when I place url links in custom blocks. Where would I change this?

From what I see in the rendered html, it looks like target_blank is being added to the url, which causes it to open in a new window (if I remember correctly).

2
Xman04
Re: How do I prevent linked site pages from opening in a new window?
  • 2006/5/22 20:44

  • Xman04

  • Not too shy to talk

  • Posts: 180

  • Since: 2004/7/12


Hi,

I found the templates that the notifications use. The templates are in the mail templates of the language folders of each module. The templates include unchanging text and embedded smarty tags to fill in stuff such as the article URL, user name, site URL, etc.

Obviously, the smarty tags are converted into URLs for the user to click on. I'm still trying to figure out where to stop the rendered URLS from including target="_blank" in their source HTML. I want them to include target="_self", so that the clicked on links open the pages within the same browser window (not open a new window). I looked at module.textsanitizer.php to see if I could change it there, but I don't see any reference to these specific tags (unless I missed it).

Where do I replace target="_blank" with target="_self" for the smarty tags included in the sample template below?

Quote:


Hello {X_UNAME},

A new story "{STORY_NAME}" has been added at {X_SITENAME}.

You can view this story here:
{STORY_URL}

-----------

You are receiving this message because you selected to be notified when new stories are added to our site.

If this is an error or you wish not to receive further such notifications, please update your subscriptions by visiting the link below:
{X_UNSUBSCRIBE_URL}

Please do not reply to this message.

-----------

{X_SITENAME} ({X_SITEURL})
webmaster
{X_ADMINMAIL}

3
Xman04
Re: How do I prevent linked site pages from opening in a new window?
  • 2006/5/23 15:04

  • Xman04

  • Not too shy to talk

  • Posts: 180

  • Since: 2004/7/12


This is getting very frustrating. I've searched all over the forum posts and don't see anything even remotely close to addressing this issue.

I'm even having trouble finding the files where the following template variables are originally defined:

X_UNAME
STORY_NAME
X_SITENAME
STORY_URL
X_UNSUBSCRIBE_URL

Maybe I'm just tired and I'm missing where those are defined. However, I've looked through many files.

I'm going to play around with the module.textsanitizer.php file, and try changing many of the target="_blank" entries to target="_self". I'm not a PHP programmer, and don't quite know what many of the patterns/replacements are referring to. However, maybe if I test one at a time I will get lucky and find one that resolves this (if the resolution is contained in that file). Or maybe, there is something that I can add to the template itself. Although, I've tried that already without success.

At this point, I'm out of ideas and don't know what else could be generating the target="_blank" behavior for these templates.

If anyone has any ideas or can send me in the right direction, I would much appreciate it.

Dave

4
Xman04
Re: How do I prevent linked site pages from opening in a new window?
  • 2006/5/24 2:40

  • Xman04

  • Not too shy to talk

  • Posts: 180

  • Since: 2004/7/12


The module.textsanitizer.php file is definitely the key. It adds the target=_blank command to some of the generated URLs within the XOOPS system.

I was able to stop the notification messages from opening in a new window, by changing one of the many target=_blank codes to target=_self.

Anyway, just wanted to let everyone know. It took me a long time to locate the source of this issue, and hopefully I can save others from spending so much time on it.

Dave

Login

Who's Online

392 user(s) are online (328 user(s) are browsing Support Forums)


Members: 0


Guests: 392


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits