Reload after upload files in html - html

I have an html form, which can be used to upload files. These files are deleted when the user navigates away into another section. Unfortunately, I'm not seeing what can be done if the user decides to reload the page or close the browser window.
I was trying to use both jQuery's $('window').on('beforeunload') but all I can achieve is a confirmation message.
Does anybody have a better idea?
Thanks in advance

This will be pretty hard as it will be browser specific, IE doesnt support many of the events. for the reload you could add a parameter to the form action like ?refresh=true then check for that. if they close the window you dont have many options. Sorry I can be more help

Related

HTML Form appearing on button press

I am a newbie to web development so sorry for my stupidity. I am actually creating a local website and I wanted to make a user profile page on that website. What I want to accomplish is that the profile page should be not be editable in the normal use case but when the user presses the Edit button (like in facebook), the fields become editable and a save button appears (basically a form but without reloading the page or any server side work). The user then updates the fields and saves. The save request will be sent to the server to update the database (can that somehow be done without reloading the page too ? i see facebook page does not reload when you edit and save).
So that is it. Waiting for a reply.
P.S. I think some javascript code will come to my rescue.
This is a very general question, so I can't do anything but give a general answer. I would highly recommend you learn jQuery.
jQuery makes it easy to manipulate the HTML and CSS from Javascript - which you'll need to do in order to show/hide the content and the forms for editing the content (or otherwise manipulate the code on the page in order to achieve what you want - there are various ways to do this, adriano's comment on your question lays out a good solution).
The specific part about sending such requests in the background is called AJAX, and jQuery has support for that too.

An html online form debugger that transforms POST to GET

I'm quite new to web development, but I'm trying to do some stuff in Python and so I need help.
Sometime ago, I went into a page to debug html forms that allowed me to change the POSTs to GETs in the form request and that really helped me get some info from html forms by just doing everything in the URL instead of having to make my program fill some forms.
Unfortunately I lost that page address and as much as I search in Google I cannot come up with it or anything similar again. Can you direct me to some links that do this?
I tried both Firebug in Firefox and developer tools in chrome, but they don't seem to do this.
Ok, this is probably quite basic for most people, but in Firebug, you just have to go into the "NET" tab, make the request and then analyse it and if you right click it and choose: "Copy location with parameters" you get the formatted URL ready to go, even when using javascript.
If you have: <form name="form1">
You can this JavaScript:
document.form1.type="GET"
Use this in the page before submitting the form.
The web developer tool bar for firefox will do this and much more:
https://addons.mozilla.org/en-US/firefox/addon/web-developer/
EDIT
You can also use firebug and inspect the form element and change it from POST to GET

Chrome extension popup, pictures and links are not working

I'm writing a chrome extension that creates a popup when the button is pressed. The popup is a simple HTML file that includes links and images. When I press the links on the popup nothing happens, and the pictures show up as empty white boxes. Does anyone know how I could fix this? The picture files are saved in the extension folder if that makes a difference.
Thank you so much!
Most probably you're dealing with two different issues.
Regarding the non working links, the simplest way to deal with it is to add to the HEAD section of your popup or a specific target to each link.
Other approach, for instance, involves associating onclick javascript events to open new browser tabs with the associated url.
Did you check out the Getting Started Tutorial about how to write extensions at http://code.google.com/chrome/extensions/getstarted.html?
It's got everything you need to walk through the basics of writing an extension that does almost exactly that. There's also a link to debugging extensions, which will hopefully help you to figure out if it's something else that's going on.
Thanks!
PEte

Is it possible to save changes in Firebug locally?

What I'm trying to do is to save the changes I make to CSS and HTML on different sites with Firebug.
Just to be clear, I don't expect Firebug to upload the changes to the server via FTP or anything. I just want to save the changes locally, so only I will be able to see them.
For example I've seen a few Firefox/Chrome extensions that add a download button under every video on Youtube, so I know it's possible to do that somehow.
If you have a different way to achieve what I'm trying to do, I'll be glad to hear about it.
(It doesn't have to be with Firebug.)
Thanks in advance!
If you don't mind using Web Developer Toolbar it's easy to save changes made to the DOM (and CSS).
When you install the toolbar, you'll get a "View Source" menu, click on that and choose "View generated source". Then just copy and paste that into a .html file.
You did not say if you alter your HTML or CSS, if CSS, FireFile is a very good addon for this.
Edit, with some Googling, i found FireDiff, which states that it can export changes made in Firebug, i have not tested it bit it's worth checking out.
You could try using Greasemonkey.
It has support for adding custom scripts that are run whenever you load a page (linked to which pages it should load on) and that can make changes to the page dynamically.
https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/
The http://chrispederick.com/work/web-developer/ web developer toolbar will let you add a user style sheet to a site which should achieve your goals.
This may or may not be exactly what you're asking for, but you can download the extension FireDiff in order to save changes made with FireBug. I made a little tutorial on how to do it here: https://www.youtube.com/watch?v=m4OmZLX2zd4
I have a somewhat simlar use-case that I solved differently. I'm not sure if it is what you are looking for or not. I'll describe the behavior and if that is helpful I'll explain exactly how I implemented it.
I changed the code that execute when you click "Run" (or Ctrl+Enter) to check to see if the first line of the code is a hard-coded string //LoadFromFile:<file path>. If it is, and the file exists then I pull the file off of the local file system and run it instead of executing the code in the console window. This way I can use an external text editor to write code.

Cannot link to chrome://newtab

I'm trying to provide a link to chrome://newtab (the new tab page) for my distraction-preventing page for when I need to access it, however clicking the link gives the error Failed to load resource.
I've tried:
Linking to it using <a href="chrome://newtab">
Attempting to redirect the user using window.location.
The chrome: prefix aliases to chrome:// but still fails to load.
Does anyone know if this is possible or has any ideas to try?
I am not sure why it doesn't work, but I think it is for security reasons.
Pages on the internet should not have access to local resources and the new tab page is a local resource.
Format your link thusly (also will work with firefox and other tabbed browsers):
Click me
EDIT: of course, that's not actually the new tab page. It's just a blank tab. Going to leave it anyways.
I think you'll have to write a Chrome extension to get access to the chrome://newtab link, it doesn't seem possible for an ordinary webpage to access it.
Edit: This solution no longer works, but I'll leave it for anyone that might try to hunt down why it stopped working.
I finally found that https://www.google.com/_/chrome/newtab will open chrome://newtab, thanks to this post.
Don't ask me why.