Jump to content

Need script to get IP and display relevant content


Recommended Posts

Posted

Hello. Hope I am in the right forum!

 

I know nothing about javascript but need a script that will:

 

get the computer IP address

IF IPaddress="217.x.x.x" then {

display an image}

else {

run a script I have

}

 

The problem is I have a nice animated slideshow on the VLE but it crashes when viewing over remote desktop.

 

Anyone?

 

Thanks

 

Darren

Posted

I'm not sure if you can do it client-side because javascript running in your browser doesn't have access to your IP address unless you set your security settings very low. I'd be a little wary of setting your browsers to trust the VLE because of all the user-uploaded content on there.

 

You can do it from the server end if you have ASP/PHP etc. - what's the VLE and what kind of server is it running on?

Posted

Thanks for the response.

 

That's a shame.

 

It is MS Sharepoint and I suspect it is running on IIS. It hasn't got anything additional installed such as PHP.

Posted

If it's on IIS, you could probably make an ASP page on that server containing something like:

 

<%@Language="JScript"%>

<%

strIP = ServerVariables("REMOTE_ADDR");

if (strIP == 'IP.OF.YOUR.TSERVER') {

Response.Redirect("tserveralternative.html");

}

else {

Response.Redirect("animatedslideshow.html");

}

%>

 

Then make your link on Sharepoint point at that asp page.

 

(code not tested, may contain nuts)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...