0

I'm developing a web app in Ruby-On-Rails. It heavily uses JavaScript. The problem is, when user clicks on a link which is suppose to make JS call and if the JavaScript is disabled or fails to load completely due to slow internet connection; it makes HTML request. This gives me error "Missing template". I don't want to redirect user to any HTML page template.

How can I disable link when JavaScript is turned off? or force to make only JS call? I want to implement something similar like Twitter.

Any help highly appreciated. Thanks :)

1 Answer 1

3

If you never want the link to actually process the href and go anywhere, then set the href for the link to "#" rather than a real URL.

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

3 Comments

hmm.. right.. but then how can I make JS call to the URL? should I specify that URL in a data attribute?
If you need data on the link, you can put it on some other attribute like a data attribute if you want.
thanks... I wonder how Twitter hide the URL! They never mention the URL. As if they construct the route in js.

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.