0

Is there a way I can go offline and reconnect with javascript / jquery. I am hoping to do this in hopes of establishing a better connection, hopefully.

The only way I can think of doing this is triggering the offline event with jQuery's .trigger('offline'); and then somehow reconnecting.

Is there a better way to do this? And / Or a way I can establish a stronger connection?

1
  • 2
    You want your code to take your device offline, then reconnect it? JavaScript has no means of controlling your network or Internet connection. It's up to the user and their device to manage "connections". Commented Sep 12, 2014 at 15:17

1 Answer 1

4

What kind of environment are you developing in? Since you're using jQuery, I assume you are in a browser. If that is the case, then no, you cannot affect the computer's network connection with JavaScript. Think of how awful that would be if every website you visited could hijack control of your internet connection!

Sign up to request clarification or add additional context in comments.

2 Comments

That is very true. Then why is there an offline event then?
so you can tell when your network connection has gone offline? Useful if your requesting information from a server. Think Facebook chat, telling you your connection is down.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.