sean-codes / atom-browser

Atom-Browser is the plugin to browse the web, preview files, auto-reload, and search Google within Atom
MIT License
39 stars 7 forks source link

Request: Scroll fix on refresh #24

Closed Lunokes closed 5 years ago

Lunokes commented 5 years ago

Hi Sean,

Just a small request which is that it would be great to have a setting so that when the browser refreshes, it doesn't scroll right back to the top - if it could fix in position that would be incredible.

Thanks Luke

sean-codes commented 5 years ago

@Lunokes Thanks for opening an issue!

Okay, after researching I was unable to find a simple way to implement this feature. Since the webview uses an iframe it seems we are able to send javascript to the webview but getting data back is not so easy because of security/cross-origin type errors. Even when trying to disable security on the iframe it was still blocking.

Screen Shot 2019-11-03 at 2 46 58 PM

To find a way around this we will create a websocket server that the iframe can talk to! With this we can get the scrollY position and use this to scroll the document on reload!

Additional info in PR: https://github.com/sean-codes/atom-browser/pull/25

If you have time to test please update to version 1.3.0 and let me know if this solves your issue! atom-browsers-save-scrollY

Lunokes commented 5 years ago

Hey @sean-codes ,

Thanks so much for the reply and for having a look at this!

I'm really not sure if it's something I am doing wrong here but I can't quite get it to work as you have? I have updated and switched on the setting on as you've done, but it doesn't seem to save - baffled:

2019-11-05 10-49-33 2019-11-05 10_51_35

Any ideas?

Lunokes commented 5 years ago

@sean-codes ,

I'm not sure how but I've just been working again and it seems to be working now. Unsure as to why it wasn't this morning. I'll keep you updated on if it stops again - thank you!

sean-codes commented 5 years ago

@Lunokes Thanks a bunch for testing! Looks like I have over engineered this a bit. Going to take another look! Our current solution will work for most scenarios but sometimes web security might block us. For example github.com will give us:

Screen Shot 2019-11-05 at 7 01 53 PM

Will push an update in a moment!

sean-codes commented 5 years ago

Update is on 1.4! This feature should now be much more reliable :]

Nov-05-2019 20-46-14

Lunokes commented 5 years ago

@sean-codes 👏👏👏 working perfectly.

Thank you Sean and hope you keep up the work on this, it's brilliant.

sean-codes commented 5 years ago

Yay, thanks for your help!