Windows server - external javascript?

pmj7's picture

He has: 234 posts

Joined: Nov 2002

Hello!

It's been a long time since I've been here!!

I'm working on a website and I'm trying to see if I can include and execute a javascript file hosted on another server on my server instead of on the client. Can this be done? Here's what I'm trying

news.asp:

<script runat=server language=javascript src=http://www.news4sites.com/service/newsfeed.php?tech=js&id=397></script>
etc...

I'm guessing that you aren't allowed to do that on a Windows (or other?) server?

I have javascript that runs on other .asp pages.

Thanks!

Peter

Touchup image processing applet
Pixel Development Web Design, Photography

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

You can load javascript from any place that allows you to.

http://www.news4sites.com/service/newsfeed.php?tech=js&id=397 is available for browsing.

&lt;script src=http://www.news4sites.com/service/newsfeed.php?tech=js&id=397&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
... you're missing this part that actually displays the data acquired by the first script.
&lt;/script&gt;
'

Of course, one wonders why you wouldn't use the asp option...

Anyway, it's always better to ask the people providing the feed on how to implement it.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

pmj7 wrote: I'm guessing that you aren't allowed to do that on a Windows (or other?) server?

I don't believe so.

You might look into downloading the file in a sheduled job (I think that is windows equivalent to cron jobs?). Then you should be able to runat=server on your localhost.

Mark Hensler
If there is no answer on Google, then there is no question.

pmj7's picture

He has: 234 posts

Joined: Nov 2002

Hi

Thanks, Suzanne, I found out about the alternate method of getting the feed later in the day. For other services/scripts, downloading them periodically to the server sounds like a good solution!

Thank you both!

Peter

Touchup image processing applet
Pixel Development Web Design, Photography

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.