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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:10:20+00:00 2026-06-17T06:10:20+00:00

I’m working with a URL shortener script Yourls. Work is going fine after getting

  • 0

I’m working with a URL shortener script Yourls. Work is going fine after getting some help from you guys. Thank you for that.
Every button is pressed for shorten URL, a popup appear, showing Short URL for that Page. This simple method is fine for Firefox, but I cannot select the text/Shorten URL in Popup in Internet Explorer.
Any suggestions how to show selectable text in popup?

This is the code of the page:

<?php 
// Start YOURLS engine
require_once( dirname(__FILE__).'/includes/load-yourls.php' );

function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); }

?>
<!DOCTYPE html>
<html>
<head>

</head>

<body>

<div id="container">
    <?php
    // Part to be executed if FORM has been submitted
    if ( isset($_REQUEST['url']) ) {
        $url     = yourls_sanitize_url( $_REQUEST['url'] );
        $return  = yourls_add_new_link( $url );     
        $shorturl = isset( $return['shorturl'] ) ? $return['shorturl'] : '';

        echo <<<RESULT
        "<script type='text/javascript'>alert('$shorturl');</script>"
RESULT;

    // Part to be executed when no form has been submitted
    } else {

        $site = YOURLS_SITE;
        $var = selfURL();
        echo <<<HTML
        <form method="post" action="">      
        <p><input type="hidden" name="url" value="$var" /></p>
        <p><input type="submit" value="Shorten" /></p>
        </form> 
HTML;
    }
    ?>
</div>
</body>
</html>

I want to edit the code where its saying

"<script type='text/javascript'>alert('$shorturl');</script>"

How can I make the text selectable to copy?

And can any one please tell me why the page http://taimoorsultan.com/y/ is redirecting to another page when we press the button? Is it possible to show the popup on the same page without going to next page? I have already pasted the complete code above.! Thank you!

This is the Current Code::

<?php 
// Start YOURLS engine
require_once( dirname(__FILE__).'/includes/load-yourls.php' );

function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); }

?>
<!DOCTYPE html>
<html>
<head>
<!--Testing-->
   <?php if(isset($_REQUEST['url']): // <-- only include jQuery if url set ?>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
  <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
  <script>
  $(function() {
    $( "#dialog-modal" ).dialog({
      height: 140,
      modal: true
    });
  });
  </script>
  <?php endif; ?>
<!--Testing-->
</head>

<body>



<div id="container">
    <?php
    // Part to be executed if FORM has been submitted
    if ( isset($_REQUEST['url']) ) {
        $url     = yourls_sanitize_url( $_REQUEST['url'] );
        $return  = yourls_add_new_link( $url );     
        $shorturl = isset( $return['shorturl'] ) ? $return['shorturl'] : '';

        echo <<<RESULT

RESULT;

    // Part to be executed when no form has been submitted
    } else {

        $site = YOURLS_SITE;
        $var = selfURL();
        echo <<<HTML
        <form method="post" action="">      
        <p><input type="hidden" name="url" value="$var" /></p>
        <p><input type="submit" value="Shorten" /></p>
        </form> 
HTML;
    }

    ?>


</div>

<?php if(isset($_REQUEST['url']): // <-- only include the div if url set ?>
<div id="dialog-modal" title="Basic modal dialog">
  <p><?php echo htmlspecialchars($shorturl); ?></p>
</div>
<?php endif; ?>


</body>
</html>
  • 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-17T06:10:22+00:00Added an answer on June 17, 2026 at 6:10 am

    It isn’t possible to change select-ability of the text in Internet Explorer. alert()‘s are very basic ways of displaying a message and there are no configurable options, other than the message.

    If you want more control you’ll have to display the message on the page instead, or create your own dialog or use something like the jQuery UI Dialog.

    For example on the page instead:

    echo '<p>' . htmlspecialchars($shorturl) . '</p>';
    

    Or in an <input>:

     echo '<input type="text" value="' . htmlspecialchars($shorturl) . '" />';
    

    To add a jQuery Dialog to your page, your <head> section would need to look like (using the jQuery CDN):

    <head>
      <?php if(isset($_REQUEST['url'])): // <-- only include jQuery if url set ?>
      <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
      <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
      <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
      <script>
      $(function() {
        $( "#dialog-modal" ).dialog({
          height: 140,
          modal: true
        });
      });
      </script>
      <?php endif; ?>
    </head>
    

    Add the div that will become the dialog to within your <body> element:

    <?php if(isset($_REQUEST['url'])): // <-- only include the div if url set ?>
    <div id="dialog-modal" title="Basic modal dialog">
      <p><?php echo htmlspecialchars($shorturl); ?></p>
    </div>
    <?php endif; ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a small JavaScript validation script that validates inputs based on Regex. I
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary
I have a text area in my form which accepts all possible characters from
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Does anyone know how can I replace this 2 symbol below from the string

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.