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 6708315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:44:39+00:00 2026-05-26T07:44:39+00:00

javascript alert box showing url + msg. i have not passed any thing but

  • 0

javascript alert box showing url + msg. i have not passed any thing but it shows url on the top of alert box. how can i remove this url ? The url is showing when my site is redirected from another site.

Means redirect from abc.com to xyz.com and alert box showing xyz.com + msg ?

  • 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-05-26T07:44:40+00:00Added an answer on May 26, 2026 at 7:44 am

    How can i remove site url from top of javascript alert?

    You can’t. The browser adds that so that the user knows that the message isn’t from the browser itself.

    The only thing you can do is stop using alert entirely, and instead use modern techniques for overlaying an element on top of the page. You can write this yourself, or use any of the many “lightbox” libraries out there. Note that doing so changes how you code things a bit, because while alert (and confirm and prompt) bring execution of scripts on the page to a screeching halt while they’re on-screen, you can’t do that in your own code, so you have to structure your code to continue when it receives the event that the user dismissed the box. Usually the library will give you a callback you can use for that, so for instance this alert code:

    function foo() {
        doSomething();
        alert("Foo!");
        if (x != 42) {
            doSomethingElse();
        }
    }
    

    becomes

    function foo() {
        doSomething();
        someNiftyLightboxThingy("Foo!", function() {
            if (x != 42) {
                doSomethingElse();
            }
        });
    }
    

    Not hard, you just have to get used to it.

    You don’t have to use a library for this, but doing so lets you not worry about edge cases and may offer you more features. Here’s a fairly bare-bones example:

    HTML:

    <input type='button' id='btnPopup' value='Click for Pop-Up'>
    

    CSS:

    iframe.shim {
      width:            100%;
      height:           100%;
      position:         absolute;
      left:             0px;
      top:              0px;
      z-index:          100;
      background-color: #fff;
      opacity:          0.5;                 /* Standard */
      filter:           alpha(opacity = 50); /* For IE */
    }
    div.overlay {
      z-index:          101;
      border:           1px solid black;
      background-color: #ecc;
      position:         absolute;
      left:             100px;
      top:              100px;
    }
    

    JavaScript:

    function doVerySimplePopup(text, callback) {
      var shim, div, parent = document.body;
    
      shim = document.createElement('iframe');
      shim.className = 'shim';
      parent.appendChild(shim);
    
      div = document.createElement('div');
      div.className = 'overlay';
      div.innerHTML = text;
      parent.appendChild(div);
      div.onclick = function() {
        parent.removeChild(div);
        parent.removeChild(shim);
        if (typeof callback === "function") {
          try { callback(); } catch (e) { }
        }
      };
    }
    

    Live example

    Obviously you’d want to tart that up a bit, and again, this is a bare-bones example, not a complete solution.

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

Sidebar

Related Questions

I have an alert box in JavaScript which is prompted by clicking a link
For a standard Javascript alert() box, is it possible to have it appear in
How can I change the title message of an alert box in JavaScript?
The JavaScript alert box is appearing without close mark on top right side nor
how can i use an alert box in asp.net web application without using javascript
I have simple javascript alert box i want it to close automatically after 5
I have a web application where i am displaying an javascript alert box when
I have a simple javascript method to show an alert box. The method is
i am trying to figure out how to create a javascript alert box asking
I want to be able to close an alert box automatically using Javascript after

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.