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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>13824</bug_id>
          
          <creation_ts>2011-08-18 13:07:19 +0000</creation_ts>
          <short_desc>If location.href is set in window.onload, firefox treats it as a redirect and removes the page from the session history. Consider specifying that.</short_desc>
          <delta_ts>2011-10-21 22:30:50 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#location</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>adrianba</cc>
    
    <cc>ayg</cc>
    
    <cc>eseidel</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>mjs</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
    
    <cc>w3c</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>55422</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-08-18 13:07:19 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/complete/history.html
Multipage: http://www.whatwg.org/C#location
Complete: http://www.whatwg.org/c#location

Comment:
If location.href is set in window.onload, firefox treats it as a redirect and
removes the page from the session history. Consider specifying that.

Posted from: 85.227.157.71 by simonp@opera.com
User agent: Opera/9.80 (Macintosh; Intel Mac OS X 10.5.8; U; en) Presto/2.9.168 Version/11.50</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55423</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-08-18 13:09:40 +0000</bug_when>
    <thetext>Probably also if it&apos;s set before onload.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57801</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-04 20:04:20 +0000</bug_when>
    <thetext>That&apos;s relatively easy to do (just means that that navigation is done &quot;with replacement enabled&quot; if &quot;something is delaying the load event&quot;). Do other browsers do this? Do they want to?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57810</commentid>
    <comment_count>3</comment_count>
    <who name="Adrian Bateman [MSFT]">adrianba</who>
    <bug_when>2011-10-04 20:27:04 +0000</bug_when>
    <thetext>IE does not do this. We don&apos;t see a reason to change: web developers can use location.replace if they want this behaviour.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57861</commentid>
    <comment_count>4</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-10-05 19:47:41 +0000</bug_when>
    <thetext>If the document&apos;s location is set in or before the load event, it might mess up the history if it&apos;s kept.  Namely, hitting back will go to the previous page, which will immediately send you back to the current page.  This is annoying, and I&apos;ve seen it happen.  It means the user has to hit back very quickly multiple times in succession, or else pick a page to navigate to from the back button drop-down menu (which not all users will know about of think of).

It&apos;s unlikely that authors will want this to happen, and it&apos;s annoying for users.  Setting location.href is the obvious way to change the URL, and few authors will even think about whether the current page will remain in the history or what implications that will have for hitting Back.  So location.href should behave in the most useful way by default.  If authors explicitly want to have such a transient page in the tab history for some reason, they should have to opt in by explicitly using location.assign, so that it&apos;s harder for them to shoot themselves in the foot.

With the test page

&lt;!doctype html&gt;
&lt;script&gt;location.href = &apos;http://www.google.com/&apos;&lt;/script&gt;

I find that IE9 preserves the intermediate page in the history, but Firefox 8.0a2, Chrome 15 dev, and Opera 11.50 do not.  In IE9, I do indeed have to hit back very rapidly or use the drop-down menu to successfully go back.  With

&lt;!doctype html&gt;
&lt;body onload=&quot;location.href = &apos;http://www.google.com/&apos;&quot;&gt;

I seem to get the same results in all browsers.

So it seems like we should definitely do this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57895</commentid>
    <comment_count>5</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2011-10-06 07:59:55 +0000</bug_when>
    <thetext>I agree with Aryeh. Lots of pages to &quot;redirects&quot; by setting location.href. Breaking the back button is a bad user experience.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58665</commentid>
    <comment_count>6</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-21 22:30:50 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: no spec change
Rationale: Turns out the spec already says this, actually.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>