ruliang / reallysimplehistory

Automatically exported from code.google.com/p/reallysimplehistory
Other
0 stars 0 forks source link

<no title> #41

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Load rshTestPage.html into IE 6.
2. In the location bar, type: "javascript:dhtmlHistory.add('key1', 'value1')"
3. Press enter.  The history event is persisted.
4. In the location bar, type: "javascript:dhtmlHistory.add('key2', 'value3')"
5. Press enter.  The history event is persisted.
6. In the location bar, type: "javascript:dhtmlHistory.add('key3', 'value4')"
7. Press enter, browser crashes.

What is the expected output? What do you see instead?

I expect that key3 and value3 are persisted just as adding any history data
would.

What version of the product are you using? On what operating system?

RSH 0.6 final.
Windows XP SP2
IE 6

Please provide any additional information below.

This does not happen in Firefox.

Original issue reported on code.google.com by jeffrey....@gmail.com on 12 Dec 2007 at 1:25

GoogleCodeExporter commented 9 years ago
I can replicate similar behaviour in my Win2K/IE6 install. For me, the browser
doesn't crash, it just loads a blank page with JavaScript errors.

I can only replicate this with JavaScript pseudo-URLs in the address bar, 
though,
which is hardly what the library is meant for. Have you seen similar behaviour 
based
on user interaction with the actual browser?

It's hard to know what's causing this, but I can't see spending time to debug 
this
over real issues that will affect users. It's not even a corner case - it's 
something
only a developer would ever see. If you're able to diagnose a specific issue in 
the
library that is causing this, I'd love your help. I wonder if it's something to 
do
with the funtions that compare window.location between the iframe and the main
window. Perhaps having manually entered JavaScript URLs in the address bar is 
messing
that up? I know Brad's original functionality to handle cases where the user 
manually
edits the hash location have degraded due to IE6 patches over the past two 
years. It
seems as if this could be related.

Original comment by bdpathfi...@gmail.com on 13 Dec 2007 at 9:40

GoogleCodeExporter commented 9 years ago
Thank you for the reply. 

Two things:  First, I was able to resolve this specific issue (I will show my
solution later in this post). Second, while I agree with you that this 

particular issue will only affect developers, I do think that debugging this 
error
might actually be more beneficial than what you are suggesting.

For example: If you are developing a web application that has one or more Flash
objects embedded into the HTML markup, the only way for the Flash object to 
register
history events on the stack is through invoking a function through Javascript --
whether it is a direct call to dhtmlHistory.add(p1, p2) or some decorator 
function.  

My opinion is that the getURL(string p1) function in ActionScript has the best
compatibility with the widest range of browsers, as far as invoking javascript
functions from within a Flash movie, and by that logic therefore will probably 
be
used by most developers. It also has no dependencies on function signatures in 
order
to communicate with Javascript. But because in ActionScript, invoking
getURL('javascript:foo();') is exactly the same as typing 'javascript:foo()' in 
the
location bar, the RSH web app will always error in the manner you described. 
Because
of this, flash-based websites will not benefit from the capabilities of RSH in 
IE 6.

---

Here is the solution:

1. The flash app must be changed to invoke Javascript using fscommand(string p1,
string p2) instead of getURL(string p1)
2. The flash object must be embedded with a specific naming convention
3. VBScript and Javascript functions with specific names and signatures must be
present on the page in order to properly process the fscommands.

So the resulting <head> section would need to contain the following:

<script type="text/javascript" language="javaScript">

function moviename_DoFSCommand(command, args) 
{ 
  if (command == 'functionName') 
  { 
    // Do something, i.e. dhtmlHistory.add(...) 
  } 
} 

</script>

<script language="VBScript">

Sub moviename_FSCommand(ByVal command, ByVal args) 
  call moviename_DoFSCommand(command, args) 
end sub 

</script>

Assuming that you have embedded your flash object in this manner with the 
appropriate
name and ID values somewhere in the <body>.

Original comment by jeffrey....@gmail.com on 13 Dec 2007 at 10:46