473,473 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Cookie editor bookmarklet

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='http://visitjesper.homeip.net/cookieeditor.js';w=window.open();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,
Jesper

Jul 23 '05 #1
2 2231
Ivo
"Jesper Rønn-Jensen" wrote

javascript:(function(){u='http://visitjesper.homeip.net/cookieeditor.js';w=w
indow.open();w.document.write('<html><head></head><body></body></html>');w.d
ocument.close();s=w.document.body.appendChild(w.do cument.createElement('scri
pt'));s.type='text/javascript';s.src=u;})()

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:

<\/tag>

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.
--
Ivo



Jul 23 '05 #2
Thanks for your response. Good points about declaring my variables with
'var'.
Jesper

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gaikokujin Kyofusho | last post by:
Hi, I am trying to find a wikipedia bookmarklet for Opera that would allow me to lookup something highlighted on a page. I could have sworn that the one i had worked until i had to reinstall opera...
1
by: Robert Oschler | last post by:
In pre-Windows XP Internet Explorer, adding a bookmarklet for a user was really simple. All I add to do was create a link that executed addFavorite(). Internet Explorer under Windows XP won't...
25
by: bweaverusenet | last post by:
Hi. I am trying to get some javascript to work in IE6, from the address line. It works in Firefox and, I believe, IE7. It appears that with some number of nested structures, the code does not...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.