Photo Gallery
Member List
Search
Calendars
FAQ
Ticket List
Log Out
Forums
Register
Login
My Profile
Inbox
Address Book
My Subscription
My Forums
adding the "www"
Logged in as: Guest
arrSession:exec spGetSession 2,3,2849
Active Users: There are
0
members and
0
guests.
Users viewing this topic: none
Printable Version
All Forums
>>
[Scripting]
>>
ASP
>> adding the "www"
Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page:
[1]
Login
Message
<< Older Topic
Newer Topic >>
adding the "www" -
5/1/2005 1:37:14 AM
bme
Posts: 2
Score: 0
Joined: 5/1/2005
From:
Status:
offline
Can I use vbscript to add the "www" into the url if it wasn't typed in? For example, someone types in
http://mydomain.com/pathtosomewhere.asp
and it returns
http://www.mydomain.com/pathtosomewhere.asp.
Thanks
Post #: 1
Re: adding the "www" -
5/1/2005 2:54:15 PM
VBS
Posts: 110
Score: 0
Joined: 3/2/2005
From: Lebanon
Status:
offline
Dear bme,
Use the code bellow, it will do exactly the same thing u want,:
<script language=vbscript> Dim strURL, strTemp, strAdd if ucase(left(location.href,11))<>"HTTP://WWW." then strURL=location.href strTemp=InStr(strURL,"://") strTemp=strTemp+2 strAdd=mid(strURL,(strTemp+1),((len(strURL)-strTemp)+1)) strAdd="http://www." & strAdd location.href=strAdd end if </script>
Hope this helps
Best Regards
Firas S Assaad
(in reply to
bme
)
Post #: 2
Re: adding the "www" -
5/4/2005 3:21:01 PM
bme
Posts: 2
Score: 0
Joined: 5/1/2005
From:
Status:
offline
Thank you for the code. It works well in IE but doesn't work in Netscape or Firefox. Any ideas why?
(in reply to
bme
)
Post #: 3
Re: adding the "www" -
5/4/2005 4:06:03 PM
VBS
Posts: 110
Score: 0
Joined: 3/2/2005
From: Lebanon
Status:
offline
Dear bme,
This code doesn't work in any other explorer than IE cause it is written in VBScript, so to let it work in all browsers it should be written in JavaScript. So i'll try to convert it to JavaScript as soon as possible.
Best Regards
Firas S Assaad
(in reply to
bme
)
Post #: 4
If you found our site useful please link to us
<a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>
.
All Forums
>>
[Scripting]
>>
ASP
>> adding the "www"
Page:
[1]
Jump to:
Select a Forum
All Forums
----------------------
[Welcome]
- - Forum Rules
- - Test Posting Messages
- - New Member Area/Introduction
[Scripting]
- - WSH & Client Side VBScript
- - WSH & Client Side VBScript Tutorial
- - Post a VBScript
- - Windows PowerShell
- - ASP
- - ASP.NET
- - Windows Script Components
[General Forum]
- - Other Programming/Scripting Languages
- - Suggestions & Feedback
- - Off-Topic Lounge
New Messages
No New Messages
Hot Topic w/ New Messages
Hot Topic w/o New Messages
Locked w/ New Messages
Locked w/o New Messages
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
Forum Software ©
ASPPlayground.NET
Advanced Edition
2.5.5 ANSI