¿Hay alguna forma de agregar hash # a mi URL sin redireccionar?
javascript
jquery
hash
Dee
fuente
fuente

Para HTML directo, sin necesidad de JavaScript:
<a href="#something">Add '#something' to URL</a>O, para tomar su pregunta más literalmente, simplemente agregue '#' a la URL:
<a href="#">Add '#' to URL</a>fuente
#a la URL. En realidad, hacer clic en un enlace como sugerí cumplirá con eso. No es necesario JS.window.location.hash = 'whatever';fuente
#prefijo no es obligatorio.Prueba esto
var URL = "scratch.mit.edu/projects"; var mainURL = window.location.pathname; if (mainURL == URL) { mainURL += ( mainURL.match( /[\?]/g ) ? '&' : '#' ) + '_bypasssharerestrictions_'; console.log(mainURL) }fuente