How to submit a form / click button?

How to add to this working bookmarklet

javascript:void(window.open(%27https://developers.facebook.com/tools/debug/sharing/?q=%27+window.location.href,%27_blank%27));

submitting of the following form?

<form rel="async" action="/tools/debug/sharing_rescrape/?elem_id=u_0_0" method="post" onsubmit="return window.Event &amp;&amp; Event.__inlineSubmit &amp;&amp; Event.__inlineSubmit(this,event)" id="u_0_6">
     <input type="hidden" name="fb_dtsg" value="AQH1ok_IYCTG:AQGqk6oXVqIV" autocomplete="off">
     <input type="hidden" autocomplete="off" name="url" value="http://example.com/new-page.html/">
     This URL hasn't been shared on Facebook before.
     <button value="1" class="_42ft _4jy0 _3-9a _4jy3 _517h _51sy" type="submit">
          Fetch new information
     </button>
     <span class="img _55ym _55yn _55yo _5tqs" aria-busy="true" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuetext="Loading..."></span>
</form>

Tried to get it done with adding of document.form[0].submit(); and document.getElementsByTagName('button').submit(); but failed. Any help is highly appreciated:)

Your code would have been much more readable if you had formatted and indented it properly. I took the liberty to do it this time, because it was very hard to understand the way it was before.

2 Likes
onsubmit="return window.Event &amp;&amp; Event.__inlineSubmit &amp;&amp; Event.__inlineSubmit(this,event)"

I’m… not entirely sure what this code is meant to do… but anyway, before the word return, stick your window.open command in.

@m_hutley firstly about the purpose: on the url https://developers.facebook.com/tools/debug/sharing/ is a code debugger. The debugger looks different depending on was an url already ever checked or not. But the submit button of debugger is always the same - this is the form and button i cited in the first post.

What i want to achieve:

  1. Step 1 (already done): to transfer an url of current (any) page into new tab, add it to the debugger url. This part works already with the code part javascript:void(window.open(%27https://developers.facebook.com/tools/debug/sharing/?q=%27+window.location.href,%27_blank%27));
  2. Step 2 (need help): i want start the debugger through submitting the button in the form.

Your code doesn’t work for me :frowning:

I used it as javascript:void(window.open('https://developers.facebook.com/tools/debug/sharing/?q='+window.location.href,'_blank'));onsubmit='return window.Event &amp;&amp; Event.__inlineSubmit &amp;&amp; Event.__inlineSubmit(this,event)'

After click on it the content of the current page was replaced with the text return window.Event && Event.__inlineSubmit && Event.__inlineSubmit(this,event), like on screenshot - the page with debugger was remaining as it was, without to start the debugger.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.