History Plugin Compatibility

6 views
Skip to first unread message

frog3

unread,
Sep 24, 2010, 9:36:20 AM9/24/10
to JavaScriptMVC
I've implemented controller/history in my application. I have one
document controller [onDocument: true] that handles all history
events, delegating action as appropriate to element controllers. What
I've come to find is that history works fine on my machine, whether
FireFox or IE 7. Yet on other machines using IE 7 the hash will change
but the content will not update unless a refresh is forced. In IE 8 it
only seems to work if in compatibility view. The forum here has a few
posts regarding a problem like this but no details regarding the cause
or solution.

Justin Meyer

unread,
Sep 24, 2010, 10:10:17 AM9/24/10
to javasc...@googlegroups.com
Which version? Can you share some sample code?

Sent from my iPhone

> --
> You received this message because you are subscribed to the Google Groups "JavaScriptMVC" group.
> To post to this group, send email to javasc...@googlegroups.com.
> To unsubscribe from this group, send email to javascriptmv...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/javascriptmvc?hl=en.
>

Joseph Tate

unread,
Sep 24, 2010, 10:11:38 AM9/24/10
to javasc...@googlegroups.com
Local file history changes will not work in IE, you'll have to set up
an http server.

> --
> You received this message because you are subscribed to the Google Groups "JavaScriptMVC" group.
> To post to this group, send email to javasc...@googlegroups.com.
> To unsubscribe from this group, send email to javascriptmv...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/javascriptmvc?hl=en.
>
>

--
Joseph Tate
Personal e-mail: jtate AT dragonstrider DOT com
Web: http://www.dragonstrider.com

frog3

unread,
Sep 24, 2010, 10:42:56 AM9/24/10
to JavaScriptMVC
All development has been done on a server.

On Sep 24, 10:11 am, Joseph Tate <dragonstri...@gmail.com> wrote:
> Local file history changes will not work in IE, you'll have to set up
> an http server.
>
>
> On Fri, Sep 24, 2010 at 9:36 AM, frog3 <falconluv...@gmail.com> wrote:
> > I've implemented controller/history in my application. I have one
> > document controller [onDocument: true] that handles all history
> > events, delegating action as appropriate to element controllers. What
> > I've come to find is that history works fine on my machine, whether
> > FireFox or IE 7. Yet on other machines using IE 7 the hash will change
> > but the content will not update unless a refresh is forced. In IE 8 it
> > only seems to work if in compatibility view. The forum here has a few
> > posts regarding a problem like this but no details regarding the cause
> > or solution.
>
> > --
> > You received this message because you are subscribed to the Google Groups "JavaScriptMVC" group.
> > To post to this group, send email to javasc...@googlegroups.com.
> > To unsubscribe from this group, send email to javascriptmv...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/javascriptmvc?hl=en.
>
> --
> Joseph Tate
> Personal e-mail: jtate AT dragonstrider DOT com
> Web:http://www.dragonstrider.com- Hide quoted text -
>
> - Show quoted text -

frog3

unread,
Sep 24, 2010, 10:52:13 AM9/24/10
to JavaScriptMVC
I'm using 2.x. I ran the update after I downloaded the package a few
months ago. Offhand I don't know the specific patch level.

The basic capability starts with a dialog that allows the user to
search. The application_controller() calls the
systemselection_controller() which provides the dialog, responds to
the form submission, and changes the window.location with respective
parameters. On the appropriate history event the
application_controller() then calls the systemselection_controller()
to perform the search and display results.

jQuery.Controller.extend('applicationController',
/* @Static */
{
onDocument: true
},
'history.index subscribe': function() {
window.location = '#application/systemsearch';
},
'history.application.systemsearch subscribe':
function(eventMsg,eventVals) {
if(!this.isAppSetup) { this.setup(); }
if(!$("#systemselection").length) {
$('#application').append('<div id="systemselection"
title="System Selection"></div>');
$('#systemselection').systemselection_controller();
} else { $("#systemselection").dialog('destroy'); }

$('#systemselection').html(this.view('systemselection/init'));
$('#systemselection').dialog({draggable: false, resizable: false,
closeOnEscape: false});
},
'history.application.systemselection subscribe':
function(eventMsg,eventVals) {
if(!this.isAppSetup) { this.setup(); }
if(!$("#systemselection").length) {
$('#application').append('<div id="systemselection"
title="System Selection"></div>');
$('#systemselection').systemselection_controller();
}

$('#systemselection').dialog('destroy');
$('#systemselection').controller().systemsearch(eventVals);
}
});

On Sep 24, 10:10 am, Justin Meyer <justinbme...@gmail.com> wrote:
> Which version?  Can you share some sample code?
>
> Sent from my iPhone
>
> On Sep 24, 2010, at 8:36 AM, frog3 <falconluv...@gmail.com> wrote:
>
>
>
> > I've implemented controller/history in my application. I have one
> > document controller [onDocument: true] that handles all history
> > events, delegating action as appropriate to element controllers. What
> > I've come to find is that history works fine on my machine, whether
> > FireFox or IE 7. Yet on other machines using IE 7 the hash will change
> > but the content will not update unless a refresh is forced. In IE 8 it
> > only seems to work if in compatibility view. The forum here has a few
> > posts regarding a problem like this but no details regarding the cause
> > or solution.
>
> > --
> > You received this message because you are subscribed to the Google Groups "JavaScriptMVC" group.
> > To post to this group, send email to javasc...@googlegroups.com.
> > To unsubscribe from this group, send email to javascriptmv...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/javascriptmvc?hl=en.- Hide quoted text -

Justin Meyer

unread,
Sep 25, 2010, 7:43:00 PM9/25/10
to JavaScriptMVC
You're probably going to have to debug this yourself. Please look in
the controller/history code, is it publishing a message that you are
subscribing to?
> > > For more options, visit this group athttp://groups.google.com/group/javascriptmvc?hl=en.-Hide quoted text -

frog3

unread,
Sep 28, 2010, 11:16:14 AM9/28/10
to JavaScriptMVC
It seems the information in my original post was wrong. The issue
resides only with IE8. I did a little searching regarding IE8 and
javascript history. A few posts noted that declaring the doctype
properly forces the browser into a more strict compatibility mode. So,
I set the doctype to html5 (i.e. <!doctype html>) and history appears
to be working properly for IE8 and continues to work with Firefox and
IE7.

I was looking at the history plugins to see where there may be a
potential flaw. I noticed that the hashchange plugin is at version
1.0.0. and per the comments it was adapted from another published
plugin. I'm wondering if the original plugin may not have had the flaw
and had since been updated. I followed the URL in the comments and
found the page for the hashchange plugin is rather sparse, not
indicating any revisions.

I realize it's likely an entirely different plugin, but another site
for a hashchange plugin had a revision that noted IE8 detection was
flawed, which is what got me thinking about the plugin version.
> > > > For more options, visit this group athttp://groups.google.com/group/javascriptmvc?hl=en.-Hidequoted text -
>
> > > - Show quoted text -- Hide quoted text -

wulf

unread,
Sep 30, 2010, 2:21:24 AM9/30/10
to JavaScriptMVC
Since any history plugin must lean on hashchange as it's primary
driver, it is important to note spotty browser support.

The author of jqueryBBQ has a few articles of interest:

http://benalman.com/projects/jquery-hashchange-plugin/

Here's a snippet:
> Right now, in Internet Explorer 8, Firefox 3.6+, and Chrome 5+, you can bind callbacks to the window.onhashchange event and use it without any kind of plugin. Of course, what happens when you want your code to work in a browser that doesn’t support window.onhashchange?
>
> Well, nothing happens.. because the event doesn’t exist, so it never fires. But because jQuery provides a layer of abstraction between actual events and bound callbacks, it’s relatively easy to create a new event using jQuery’s special events.


Essentially if you're not in a browser that supports what you're
doing, you need a timer to poll for changes.

HTH,
Rob
> > > > > For more options, visit this group athttp://groups.google.com/group/javascriptmvc?hl=en.-Hidequotedtext -

Justin Meyer

unread,
Sep 30, 2010, 2:28:02 AM9/30/10
to javasc...@googlegroups.com
Rob,
  Thanks for pointing that out, but I'm tiny bit confused why you mentioned it.  The hashchange.js file in jquery/event/hashchange does poll for changes in browsers that don't support hashchange.

  Is it not working for you?


Justin Meyer

Jupiter Consulting
\Development\Training\Support
847-924-6039
justin...@gmail.com
Reply all
Reply to author
Forward
0 new messages