<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>30103</bug_id>
          
          <creation_ts>2009-10-05 18:27:55 -0700</creation_ts>
          <short_desc>Submitting an empty form with GET should not append a question mark</short_desc>
          <delta_ts>2024-08-29 15:20:56 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Forms</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Erik Arvidsson">arv</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>annevk</cc>
    
    <cc>ap</cc>
    
    <cc>brettw</cc>
    
    <cc>costan</cc>
    
    <cc>mail</cc>
    
    <cc>mtanalin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>152532</commentid>
    <comment_count>0</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2009-10-05 18:27:55 -0700</bug_when>
    <thetext>If we submit a form using GET and there is no form data we should not append a question mark &apos;?&apos;.

&lt;form action=&quot;b.html&quot; method=&quot;GET&quot;&gt;&lt;/form&gt;
&lt;button onclick=&quot;document.forms[0].submit()&quot;&gt;Submit&lt;/button&gt;

This should navigate to &quot;b.html&quot; and not &quot;b.html?&quot;

The bug seems to be in KURL::setQuery. It always adds a &apos;?&apos; no matter what

http://trac.webkit.org/browser/trunk/WebCore/platform/KURL.cpp#L779

Brett, KURLGoogle has a comment that it does not add the &apos;?&apos; and that we need to eliminate this difference but it seems we always get the extra &apos;?&apos; with KURLGoogle as well.

http://trac.webkit.org/browser/trunk/WebCore/platform/KURLGoogle.cpp#L652</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>152737</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-10-06 08:42:41 -0700</bug_when>
    <thetext>&gt; This should navigate to &quot;b.html&quot; and not &quot;b.html?&quot;

Why should it?

See bug 8051 - the form is not quite empty in that case, but that&apos;s close enough to question what the difference affecting behavior really is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>153259</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-10-07 21:37:30 -0700</bug_when>
    <thetext>Per a comment Erik added to bug 8051, Firefox doesn&apos;t do this (any more?). We need to test related cases thoroughly to determine if it&apos;s safe to undo this fix, and test IE, of course.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>153403</commentid>
    <comment_count>3</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2009-10-08 09:32:40 -0700</bug_when>
    <thetext>Bug 8051 was about an empty form that was not submitted because the URL didn&apos;t change. The action attribute was set to &quot;&quot;. We do need to submit the form in that case and this is what Firefox does. However, we should not add a &apos;?&apos;. This is important for another case when the form is empty and the action is set to a fragment identifier (#a). This is important for fixing bug 20342.

I&apos;m willing to fix this and 20342 if we can agree on the following Firefox&apos;s behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>611351</commentid>
    <comment_count>4</comment_count>
    <who name="Meixger">mail</who>
    <bug_when>2012-04-27 03:15:03 -0700</bug_when>
    <thetext>any updates to this bug/behavior?

We use form GET for tracking purposes, and some CMS breaks on urls with question marks.

Here&apos;s a demo http://jsfiddle.net/a4TeB/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>611538</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-04-27 08:47:39 -0700</bug_when>
    <thetext>We still lack results of IE testing. WebKit and IE together make a qualified majority of Web browsers, which is why it&apos;s important even if Firefox is different.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>933266</commentid>
    <comment_count>6</comment_count>
    <who name="Victor Costan">costan</who>
    <bug_when>2013-09-25 17:01:13 -0700</bug_when>
    <thetext>IE9 follows Firefox&apos;s behavior, but WebKit follows the standards. (in my understanding)

The HTML5 forms TR says that method=&quot;GET&quot; means the form data is URL-encoded, and the algorithm for that returns the empty string. The action URL mutating algorithm says the query is set to this empty string, and then the URL is serialized using the URL spec. The URL spec says that if the query is non-null, the URL gets a &quot;?&quot;.

Query computation: http://www.w3.org/TR/html5/forms.html#application/x-www-form-urlencoded-encoding-algorithm
Action URL mutating: http://www.w3.org/TR/html5/forms.html#submit-mutate-action
URL serializing: http://url.spec.whatwg.org/#serializing

Assuming we want to follow Firefox / IE instead of the standard, fixing this bug should be a matter of reverting the KURL change and updating the layout test in https://bugs.webkit.org/show_bug.cgi?id=8051

Please let me know. I&apos;d be happy to submit a patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1110123</commentid>
    <comment_count>7</comment_count>
    <who name="Marat Tanalin">mtanalin</who>
    <bug_when>2015-07-17 06:33:53 -0700</bug_when>
    <thetext>All other major browsers work correctly and do NOT append question mark to URL in case of empty GET-method form, namely:

* Firefox (at least version 4+),
* Opera 12 (Opera before switching to Chromium),
* Internet Explorer (at least version 8+),
* Microsoft Edge (Windows 10&apos;s brand new browser).

That&apos;s just common sense since the `?` separator is unneeded if there is nothing to separate (query string is empty).

Forms without fields are a valid way for creating buttons that effectively act as links that always point to the same exact URL [1].

WebKit and its fork named Chromium are currently the only engines that need the workaround based on server-side redirection [2].

[1] http://tanalin.com/en/blog/2013/03/link-button/
[2] http://tanalin.com/en/blog/2015/05/empty-query-string/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2056245</commentid>
    <comment_count>8</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2024-08-29 06:18:23 -0700</bug_when>
    <thetext>It&apos;s now standardized to always output a question mark (query is always set to a string in &quot;Mutate action URL&quot;). (This also appears to be what Chrome, Firefox, and Safari implement.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2056400</commentid>
    <comment_count>9</comment_count>
    <who name="Marat Tanalin">mtanalin</who>
    <bug_when>2024-08-29 15:20:56 -0700</bug_when>
    <thetext>&gt; It&apos;s now standardized

A link probably?

&gt; This also appears to be what Chrome, Firefox, and Safari implement.

Firefox previously did not add the redundant question mark, but Firefox 76+ apparently do: https://bugzilla.mozilla.org/show_bug.cgi?id=1591100

Among modern browsers, Vivaldi (tested 6.6.3271.53 and the latest 6.9.3447.37) seems to still do the right thing according to common sense — not to add the separator when there is nothing to separate.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>