Check out this javascript demonstration: http://fiddle.jshell.net/maple/JbEJN/show/ (for the code, refer to this link: http://jsfiddle.net/maple/JbEJN/).
This is a basic tab control created with JavaScript. Clicking 'Tab 1' reveals the contents of one section, while clicking 'Tab 2' hides the current section and displays another one with different content. This is a standard tab control system.
My goal is to use hashtags to bookmark or link directly to a specific tab on the page. However, I do not want a new browser history entry to be added every time I switch tabs. I don't want to go through multiple tabs when pressing the back button before reaching the previous page.
To achieve this functionality, I plan to utilize replaceState() to insert a hashtag into the URL whenever a tab is switched:
window.history.replaceState(null, '', '#tabname');
I expect that by using this method, switching between tabs will not create additional history entries. Instead, the hashmark in the URL will change accordingly. When I press the back button, I should simply return to the previous page without cycling through each tab.
While this approach works smoothly in Chrome, Firefox, and Safari, it seems to have issues in Opera versions 11.50 and 11.60. Despite Opera's claimed support for the history API, replaceState() functions like pushState(), resulting in unwanted history entries being generated.
Is this a bug specific to Opera, or is there a different technique required to implement the API properly in Opera?