Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How would this url read in javascript?

Posted on 2008-11-06
2
Medium Priority
?
225 Views
Last Modified: 2012-05-05
Javascript Code
-------------------
if((/^https?\:\/\/(www\.)?example\.com/).test(document.referrer)){
    location.href="anotherpage.html";
}

If I wanted the url it redirected from to be:

http://v01.andrew.sparrow-dev.com/redirect/

instead of www.example.com
0
Comment
Question by:walker6o9
2 Comments
 
LVL 10

Accepted Solution

by:
MoreHeroic earned 2000 total points
ID: 22899115
if((/^https?\:\/\/(www\.)?example\.com/).test(document.referrer)){
    location.href="anotherpage.html";
}

would be

if((/^https?\:\/\/v01\.andrew\.sparrow-dev\.com\/redirect\//).test(document.referrer)){
    location.href="anotherpage.html";
}

or

if((/^https?\:\/\/v01\.andrew\.sparrow\-dev\.com\/redirect\//).test(document.referrer)){
    location.href="anotherpage.html";
}

for http://v01.andrew.sparrow-dev.com/redirect/
0
 
LVL 1

Author Comment

by:walker6o9
ID: 22979158
Do you know how this url would read?

v01.andrew.sparrow-dev.com/TEST/employee.html
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question