Potresti aggiungerlo all' URI così:
href='ristoranti.html?CarnePesce'
nella pagian chiamante:
Poi la pagina chiamata lo recupera così:codice:<html><head><title>caller-page</title> </head><body> <a class='dropdown-item' href='ristoranti.html?CarnePesce' name='CarnePesce'>Carne & pesce</a </body> </html>
Con split('?')[0] ti ritroveresti invece il primo tronco dell' URI;codice:<!DOCTYPE html PUBLIC><html> <head><title>demanded-page</title> <script type="text/javascript"> var argomento=window.location.href.split('?')[1]; </script> <style type="text/css"> </style> </head><body onload="document.getElementById('visore').value=argomento;"> <div align="center"> Usiamo <input id="visore"> come argomento da trattare </div> </body> </html>
con [2] una eventuale seconda variabile che vorresti passare.
Puoi anche fare:
ristoranti.html?ramo=CarnePesce
che figura come un passaggio PHP in GET; e allora, con split('?ramo=')[0] nel recupero.

Rispondi quotando