简体   繁体   中英

How to construct a HTML link to prefill a form field on this site

i usually have no trouble constructing HTML links to prefill any given form field. However, this one has me stumped: https://www.planningportal.nsw.gov.au/spatialviewer/#/find-a-property/address

I want to construct a link to prefill the address here, I've used all the usual structures like the following: https://www.planningportal.nsw.gov.au/spatialviewer/#/find-a-property/address#mat-input-0=100+Princes+St,+Ryde+NSW+2112 Also replacing the # with a ? does not work I believe the field ID is "mat-input-0"

Is there something obvious I am missing here? Is the site sanitising the query from the end of the link for some reason perhaps?

 var url = "https://www.planningportal.nsw.gov.au/spatialviewer/#/find-a-property/address#mat-input-0=100+Princes+St,+Ryde+NSW+2112" var address = url.split('mat-input-0=')[1].replace(/\\+/g, ' '); document.getElementById("address-input").value = address; 
 <input id='address-input' val='' size='50' /> 

you can replace url by var url = window.location.pathname; to get the parameters in your url. hope it helps :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM