I'm trying to open the zip code lookup page on the usps website and fill out the form using javascript, and I get the following error:
'Permission denied to get property Window.document'
Here's my script:
function lookupZipCode(line1, line2, city, state, zip) {
var usps = window.open('http://zip4.usps.com/zip4/welcome.jsp');
usps.document.getElementById('address2').value = line1;
usps.document.getElementById('address1').value = line2;
usps.document.getElementById('city').value = city;
usps.document.getElementById('state').value = state;
usps.document.getElementById('zip5').value = zip);
}
I understand that this is a security feature. Ideally I would use query string params but the page does not appear to support them.
Anyone have any ideas for a workaround?