Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8388567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:29:53+00:00 2026-06-09T18:29:53+00:00

Is it possible to tell the difference between a request coming directly from a

  • 0

Is it possible to tell the difference between a request coming directly from a URL in a browser vs. a resource being called from a remote web page?

For example, I would like to serve a web page when someone visits my URL directly (types in http://mywebsite.com) in a web browser, but when a user calls a resource on my app via a url from a seperate domain (like <img src='http://mywebsite.com' />) then I’d like to serve different content.

I’ve looked in the request and in the headers but it looks the same regardless of

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:29:54+00:00Added an answer on June 9, 2026 at 6:29 pm

    I think you are looking for the referer string in the request.header.

    So the simple version would look like this:

    http.createServer(function (req, res) {
      var ref = req.headers.referer;
    
      if(ref) {
        // serve special content
      }
      else {
        // serve regular homepage
      }
    }).listen(1337, '127.0.0.1');
    

    edited the answer to reflect the input from anu below – it should be referer

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to tell the difference between 2 ember-date time objects in days?
Is it possible to tell the difference between the normal exit of a using
Is it possible to tell if a workbook has been opened from an email
From within a finally block, is it possible to tell an exception has been
My question is is it possible to tell from an UIEvent object whether it
I'd like to tell the difference between valid and invalid date objects in JS,
Possible Duplicate: What's the difference between a header file and a library? Can anyone
Possible Duplicate: Is there a performance difference between i++ and ++i in C++? I
Possible Duplicate: Difference between calling self.var vs var Edit : actually, i did not
Possible Duplicate: Difference Between Equals and == String comparison and String interning in Java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.