The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
I would like to have any links in a topic that point to somewhere in my own domain to open in the same window. Currently any link in a post always opens in a new window.
Can it be set to open in the same window if it is still in my domain and open in a new window if it is outside my domain?<
Can it be set to open in the same window if it is still in my domain and open in a new window if it is outside my domain?<
Posted
I have some code for that which I seem to recall posting here; let me have a search around ...
<
Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
<
Search is your friend
“I was having a mildly paranoid day, mostly due to thefact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Posted
Here's the original topic and here's the file that I was linking to.
Actually unearthed that in this topic where I helped you do something similar on default.asp!
<
Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Actually unearthed that in this topic where I helped you do something similar on default.asp!
<
Search is your friend
“I was having a mildly paranoid day, mostly due to thefact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Last edited by Shaggy on 25 April 2008, 11:28
Posted
Thanks Shaggy. I knew I had asked this before but didn't search for it.
Anyway, I replaced the URL function in inc_func_common.asp with your code and all links now open in the same window.
Here is my test page:
http://www.mangionemagic.com/forum/topic.asp?TOPIC_ID=804
The first two links are within my own site and I want them to open in the same window (which they are currently doing).
The second two links are outside of my domain and should open in a new window but they also now open in the same window. What am I doing wrong?<
Anyway, I replaced the URL function in inc_func_common.asp with your code and all links now open in the same window.
Here is my test page:
http://www.mangionemagic.com/forum/topic.asp?TOPIC_ID=804
The first two links are within my own site and I want them to open in the same window (which they are currently doing).
The second two links are outside of my domain and should open in a new window but they also now open in the same window. What am I doing wrong?<
Posted
My domain is hardcoded into that function so you'll need to change all occurrences of WOO.IE to MANGIONEMAGIC.COM
Also note that I use my own JS function in that file to spawn new windows so you'll also need to change all occurrences of onclick=""return tL(this,'e');"" to the appropriate target attribute.
<
Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Also note that I use my own JS function in that file to spawn new windows so you'll also need to change all occurrences of onclick=""return tL(this,'e');"" to the appropriate target attribute.
<
Search is your friend
“I was having a mildly paranoid day, mostly due to thefact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Last edited by Shaggy on 28 April 2008, 04:51
Posted
Thanks Shaggy. I need one more bit of help.
How exactly do I change this:
I tried but it does not work.
Right now all links inside and outside of my forum open in the same window.
Also, am I supposed to replace the entire url function with your code or add it to the existing code? I currently replaced the whole thing. However, your code is much shorter than what I replaced. Perhaps I took out something I shouldn't have?<
How exactly do I change this:
Code:
onclick=""return tL(this,'e');""Code:
onclick=""TARGET=_BLANK;""Right now all links inside and outside of my forum open in the same window.
Also, am I supposed to replace the entire url function with your code or add it to the existing code? I currently replaced the whole thing. However, your code is much shorter than what I replaced. Perhaps I took out something I shouldn't have?<
Last edited by leatherlips on 28 April 2008, 07:38
Posted
Drop the onclick event completely and just use the target attribute. That function has been pretty heavily edited, mainly to make it more compact; other than what I've already mentioned, I don't think I've made any other changes that would effect its compatibility with a base Snitz install but it's a few years since I customised it so keep a copy of the original function to hand just in case things start going askew.
<
Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
<
Search is your friend
“I was having a mildly paranoid day, mostly due to thefact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Posted
I can't get it to work.
Here are the two spots with the onclick. What do I do to them?
oTag=" c1Tag=" target="_blank" rel="noopener noreferrer nofollow" title="">"
oTag2="[url="http://"
c2Tag=""]"
c2Tag=""
roTag="<a href="""
rc1Tag=""" onclick=""_BLANK;"">" rc2Tag="</a>"
rc3Tag=""">"
oTagPos=instr(1,strToFormat,oTag,1)
c1TagPos=instr(1,strToFormat,c1Tag,1)
if oTagpos>0 and c1TagPos>0 then
strArray=split(strToFormat,oTag,-1,1)
for Counter=0 to ubound(strArray)
if instr(1,strArray(Counter),c1Tag,1)>0 then
strArray2=split(strArray(Counter),c1Tag,-1,1)
strArray2(0)=replace(strArray2(0),Chr(34)," ")
ReplaceURLs=ReplaceURLs&"<a href="""&strArray2(0)&""" onclick=""_BLANK;"">"&strFirstPart&"</a>"&strSecondPart
elseif ucase(left(strArray2(0),7))="HTTP://" then
ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart
elseif ucase(left(strArray2(0),8))="HTTPS://" then
ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart
elseif ucase(left(strArray2(0),4))="WWW." then<
Here are the two spots with the onclick. What do I do to them?
oTag=" c1Tag=" target="_blank" rel="noopener noreferrer nofollow" title="">"
oTag2="[url="http://"
c2Tag=""]"
c2Tag=""
roTag="<a href="""
rc1Tag=""" onclick=""_BLANK;"">" rc2Tag="</a>"
rc3Tag=""">"
oTagPos=instr(1,strToFormat,oTag,1)
c1TagPos=instr(1,strToFormat,c1Tag,1)
if oTagpos>0 and c1TagPos>0 then
strArray=split(strToFormat,oTag,-1,1)
for Counter=0 to ubound(strArray)
if instr(1,strArray(Counter),c1Tag,1)>0 then
strArray2=split(strArray(Counter),c1Tag,-1,1)
strArray2(0)=replace(strArray2(0),Chr(34)," ")
ReplaceURLs=ReplaceURLs&"<a href="""&strArray2(0)&""" onclick=""_BLANK;"">"&strFirstPart&"</a>"&strSecondPart
elseif ucase(left(strArray2(0),7))="HTTP://" then
ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart
elseif ucase(left(strArray2(0),8))="HTTPS://" then
ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart
elseif ucase(left(strArray2(0),4))="WWW." then<
Posted
oTag="[url="""
c1Tag="""]"
oTag2="[url]"
c2Tag="[/url]"
roTag="<a href="""
rc1Tag=""" target=""_blank"">" rc2Tag="</a>"
rc3Tag=""">"
oTagPos=instr(1,strToFormat,oTag,1)
c1TagPos=instr(1,strToFormat,c1Tag,1)
if oTagpos>0 and c1TagPos>0 then
strArray=split(strToFormat,oTag,-1,1)
for Counter=0 to ubound(strArray)
if instr(1,strArray(Counter),c1Tag,1)>0 then
strArray2=split(strArray(Counter),c1Tag,-1,1)
strArray2(0)=replace(strArray2(0),Chr(34)," ")
ReplaceURLs=ReplaceURLs&"<a href="""&strArray2(0)&""" target=""_blank"">"&strFirstPart&"</a>"&strSecondPart
elseif ucase(left(strArray2(0),7))="HTTP://" then
ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart
elseif ucase(left(strArray2(0),8))="HTTPS://" then
ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart
elseif ucase(left(strArray2(0),4))="WWW." then
<
Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
c1Tag="""]"
oTag2="[url]"
c2Tag="[/url]"
roTag="<a href="""
rc1Tag=""" target=""_blank"">" rc2Tag="</a>"
rc3Tag=""">"
oTagPos=instr(1,strToFormat,oTag,1)
c1TagPos=instr(1,strToFormat,c1Tag,1)
if oTagpos>0 and c1TagPos>0 then
strArray=split(strToFormat,oTag,-1,1)
for Counter=0 to ubound(strArray)
if instr(1,strArray(Counter),c1Tag,1)>0 then
strArray2=split(strArray(Counter),c1Tag,-1,1)
strArray2(0)=replace(strArray2(0),Chr(34)," ")
ReplaceURLs=ReplaceURLs&"<a href="""&strArray2(0)&""" target=""_blank"">"&strFirstPart&"</a>"&strSecondPart
elseif ucase(left(strArray2(0),7))="HTTP://" then
ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart
elseif ucase(left(strArray2(0),8))="HTTPS://" then
ReplaceURLs=ReplaceURLs&roTag&strArray2(0)&rc1Tag&strFirstPart&rc2Tag&strSecondPart
elseif ucase(left(strArray2(0),4))="WWW." then
<
Search is your friend
“I was having a mildly paranoid day, mostly due to thefact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Last edited by Shaggy on 28 April 2008, 10:12
Posted
Perfect! Thank you so much for your patience and help!
<
Email Member
Message Member
Post Moderation
FileUpload
If you're having problems uploading, try choosing a smaller image.
Preview post
Send Topic
Loading...