Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onload Event & localStorage #21

Closed
greenexile4568 opened this issue Aug 16, 2011 · 3 comments
Closed

Onload Event & localStorage #21

greenexile4568 opened this issue Aug 16, 2011 · 3 comments

Comments

@greenexile4568
Copy link

When Browser javascript function is invoked it adds a listener to the page onload event. For standard alone pages this is okay but for apps where the browser is loaded as a plugin, the page load event may not fire.

Just a suggestion, but it maybe better to leave the invocation of the browser to the caller and not assume which event they may wish to use to trigger the actual rendering of the browser.

On the same topic, if the browser is deployed within a div on a larger page it appears you have to flush localStorage otherwise the browser has a 'fit' if you try to refresh/reload it insitu. ( admittedly some of this behavior may be the result of the application I'm trying to embed the browser)

p.s.

Would like to commend you on a great piece of work !

@dasmoth
Copy link
Owner

dasmoth commented Aug 18, 2011

I'm guessing you're creating the Browser object after the onload event has already fired? (i.e. probably in an event handler, rather than in a top-level script?). I'll see if I can find a fix that doesn't break the current API (maybe check to see if the onload event has already fired?). In the mean time, you should be able to work around this using something like:

           Browser b = new Browser{/*config*/};
           b.realInit();

I'm not totally sure what you mean by "flushing localStorage", please could you give an example?

@greenexile4568
Copy link
Author

Aye, thats pretty much how I worked around the issue.

The app I'm using has a pugin frame work that calls an init function when
loading a plugin and a unload function when user selects another plugin
within the interface. When the latter is invoked I call

localstorage.clear

This removes any data added by dalliance. If the user then reloads the
dalliance from the same browser/app session the browser has nothing in
localstorage and loads correctly.

If I don't do this it looks like (I haven't had time to look indepth) the
browser starts creating multiple tracks - almost seems like it gets suck in
a recursive loop whch eventually leaves Firefox session unusable.

On 18 August 2011 04:11, dasmoth <
reply@reply.github.com>wrote:

I'm guessing you're creating the Browser object after the onload event has
already fired? (i.e. probably in an event handler, rather than in a
top-level script?). I'll see if I can find a fix that doesn't break the
current API (maybe check to see if the onload event has already fired?). In
the mean time, you should be able to work around this using something like:

          Browser b = new Browser{/*config*/};
          b.realInit();

I'm not totally sure what you mean by "flushing localStorage", please could
you give an example?

Reply to this email directly or view it on GitHub:
#21 (comment)

@dasmoth
Copy link
Owner

dasmoth commented Jul 31, 2014

Since 0.12 there has been no need to explicitly initialize newly created Browsers.

I've not been able to reproduce the issue with localStorage.

@dasmoth dasmoth closed this as completed Jul 31, 2014
jmtcsngr added a commit to jmtcsngr/dalliance that referenced this issue Nov 22, 2016
bring uiclient dep from npg_ranger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants