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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:38:41+00:00 2026-05-14T22:38:41+00:00

I have a script that links to the server I am hosting (IP can

  • 0

I have a script that links to the server I am hosting (IP can change) usually I would just use for links:

 var url ='http://' + window.location.hostname + 'end of url';

But in this case it isnt appearing to be so easy.

I have tried: (1)

$('#scriptid').attr('src', url);

as well as: (2)

var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = url;
$("#insert").append( script );

Now case (2) works loads the script runs the script. But when at the end of my script it hits the ‘write data’ it decides to replace the entire page with just the data.

Any idea on how I can do this?


Note: I am using plain html not ASP. With ASP backend that is just the way it has to be.

Ok it now is

<script src="myscript.js"></script>

C#

router.AddAsyncRoute("myscript.js"......

It workes in IE & FF. But I get blank pages in Chrome & Safari. I am using document.write to write a script onto my page.

Any ideas why Chrome & Safari don’t like this?

I am so far assuming that in Crhome & Safari it takes longer to run the script therefore launching the document.write after the DOM has loaded therefore replacing the page with a blank one.

Any ideas how I can get around this?
I am not to sure how to implement an appenChild in this case as the script is changing constantly with live data. So every refresh it will generally have changed some…


So setting the Route actually does work perfectly fine..
I was having issues with loading it not because of my document.write yes i know its nasty but because Skype was hogging port 80 but only for Safari and Chrome because I had been using FF & IE before skype started.
So a simple disable of letting skype have port 80 in connection options and the

<script src="myscript.js"></script>

&

router.AddAsyncRoute("myscript.js"......

Work perfectly fine ^^

So the question still remains as I would still like to find out (if possible) how to set the ‘src’ tag of a script to a variable or so?

  • 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-14T22:38:42+00:00Added an answer on May 14, 2026 at 10:38 pm

    Don’t use absolute paths (domain name, IP). Just use the relative path to your script and you’re good. Then you won’t have to do any of this replacing etc. For instance if your script is called my_script.js don’t use src="http://...my_script.js" use src="my_script.js".

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

Sidebar

Related Questions

I have a php script that grabs links from another website. I am storing
I have script that reads remote file content and writes it to local server.
We have our own web server hosting our website that is open to the
I have this script. I need is so that it only writes the links
I was wondering if someone can help me, I have the following script that
So I have a user control that displays links and I want to change
I have a method that checks for broken links: def self.check_prod_links require 'net/http' results
I have a script that has PHP on it, and a link that goes
I have a script that generates two lines as output each time. I'm really
I have the following script that runs when a user clicks a link that

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.