After redirecting page using jQuery, can I fill an input field on new page?

前端 未结 1 1250
予麋鹿
予麋鹿 2021-01-25 12:21

I put a jQuery redirect code in a page. After loading the page it opens a link on a new tab. I want to fill an input field with \"myid1234\" on the new page which is opened on n

相关标签:
1条回答
  • 2021-01-25 12:38

    Unfortunately, you can't! Even if you want to use a javascript injection like for example:

    javascript:void(document.forms[1].sellerID.value='myid1234');
    

    Simply, because you want to access a different URL. If the page you want to access does exist in the same root, it would be possible. Check this link example to see a working example (Just remember to allow the pop-ups).

    Although, you still have one chance to make it work. I'm gonna show you with this simple example: suppose you want to search something with google engine, you wanna do something like this:

    <div>
      <form method="GET" action="http://www.google.com/search" target="_blank">
        <label for="search-id">Search</label>
        <input name="q" class="data_field" id="search-id" type="search" placeholder="Introduce your request" />
        <button type='submit'>OK</button>
      </form>
    </div>
    

    Check this link jsfiddle to see a working example. In your case you should replace www.google.com/search by the url action of the site, which is http://www.shopabcfr.com/store/brochures.php. Hope it's useful!

    0 讨论(0)
提交回复
热议问题