By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,629 Members | 1,703 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,629 IT Pros & Developers. It's quick & easy.

Cookie editor bookmarklet

P: n/a
Hi everybody.
I just created a bookmarklet that can view, add and edit cookies.
Feel free to use it, if you like. And please share any modifications
you make.

I had a hard time figuring out exactly which characters are allowed.
For instance, i _think_ the equal sign (=) is allowed even though it
has special meaning in the cookie string.

The bookmarklet creates a popup window and loads a javascript file from
my webserver.

I really appreciate any comments/feedback/suggestions.
For now, I have tried it in Firefox 1.0.1 and IE6 /windows

javascript:(function(){u='';;w.document.write( '<html><head></head><body></body></html>');w.document.close();s=w.document.body.appen dChild(w.document.createElement('script'));s.type= 'text/javascript';s.src=u;})()
Kind regards,

Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
"Jesper Rønn-Jensen" wrote

ocument.close();s=w.document.body.appendChild( cument.createElement('scri

Well, encapsulating your statements in a function is rather nice but also
quite pointless if you don't initialize the variables using the "var"
keyword. Because now they still end up being global variables which is never
a good idea and certainly not in bookmarklet that need to adept to any and
all pages that may well have their own global variables that you don't want
to interfere with.
The url to your .js file is in a variable "u" that you use only once, why
not assign it directly to "s.src"? And why mix document.write() and
document.createElement()? Also, when writing HTML with javascript, the
closing tags should look like this:


with a backslash escaping the slash. It may not break the script in all
cases if you don't, but it never hurts so it 's best to get used to it. A
parser might think the script section has ended when it encounters the
string "</" without backslash, ending your script prematurely.

Jul 23 '05 #2

P: n/a
Thanks for your response. Good points about declaring my variables with

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.