473,654 Members | 2,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Safari "TypeError - Undefined value" with bookmarklet, need advice

Hi,

I have a bookmarklet that works perfectly in Firefox, IE, Konqueror,
and Opera, but in Safari 2.0.3 (417.9.2) it doesn't work. I enabled
debugging and I can see "TypeError - Undefined value" reported in the
Javascript console, but I'm not sure where the error is.

The bookmarklet in question is here:

javascript:if (parseInt(navig ator.appVersion ) >= 4) { if
(navigator.user Agent.indexOf(' MSIE') 0) { q =
document.select ion.createRange ().text; } else if
(navigator.user Agent.indexOf(' Safari') 0) { q =
document.select ion.createRange ().text; } else { q =
document.getSel ection(); } if (!q) { void(q = prompt('Enter
keywords to search your Simpy Links:', '')); } if (q) {
location.href=' http://www.simpy.com/simpy/LinkSearch.do?q =' +
encodeURICompon ent(q); }}

I tried changing the "document.selec tion.createRang e().text" bit in the
case of Safari to "document.getSe lection()", but that didn't work
either, the error being "TypeError - Value undefined (result of
expression document.getSel ection) is not object".

Does anyone know how to get the selected text under Safari?

If anyone's interested, this bookmarklet is from Simpy -
http://www.simpy.com/simpy/BrowserBookmarklets.do

Any help would be very appreciated. Thank you!

Aug 6 '06 #1
1 5900
A possible solution: window.getSelec tion() instead of
document.select ion.createRange ().text and document.getSel ection().

Is that the right thing to do for Safari?

Thanks.

OtisUsenet wrote:
Hi,

I have a bookmarklet that works perfectly in Firefox, IE, Konqueror,
and Opera, but in Safari 2.0.3 (417.9.2) it doesn't work. I enabled
debugging and I can see "TypeError - Undefined value" reported in the
Javascript console, but I'm not sure where the error is.

The bookmarklet in question is here:

javascript:if (parseInt(navig ator.appVersion ) >= 4) { if
(navigator.user Agent.indexOf(' MSIE') 0) { q =
document.select ion.createRange ().text; } else if
(navigator.user Agent.indexOf(' Safari') 0) { q =
document.select ion.createRange ().text; } else { q =
document.getSel ection(); } if (!q) { void(q = prompt('Enter
keywords to search your Simpy Links:', '')); } if (q) {
location.href=' http://www.simpy.com/simpy/LinkSearch.do?q =' +
encodeURICompon ent(q); }}

I tried changing the "document.selec tion.createRang e().text" bit in the
case of Safari to "document.getSe lection()", but that didn't work
either, the error being "TypeError - Value undefined (result of
expression document.getSel ection) is not object".

Does anyone know how to get the selected text under Safari?

If anyone's interested, this bookmarklet is from Simpy -
http://www.simpy.com/simpy/BrowserBookmarklets.do

Any help would be very appreciated. Thank you!
Aug 6 '06 #2

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

Similar topics

0
1855
by: Dave | last post by:
Hi everyone, (I already posted this to the VS.NET IDE news group without any responses, so I'm attempting one more time in this group) The issue I'm having is occuring in the IDE of VS.NET 2003, although I'm not sure what is actually causing the problem. I can't summarize the issue, so please read on to find out more. I've created a BaseDialogEditor class that allows a developer (namely me) to create Modal editors for controls at...
1
3233
by: Denzil | last post by:
Hi, I am retrieving my DB values and setting them in the MyRS::DoFieldExchange(CFieldExchange* pFX) function. One of these records is a Long datatype and could be "Null" in the DB table. The issue is when the DB value is retrieved it is fine for all integers but for a "Null" value it returns a junk long value and not a pre-defined value, say.
2
14871
by: lgo | last post by:
I have read several variations of this topic posted on this news group. However I was not able to find the answer for my problem. I am trying to build code (see below) to update a large single record using data from a temporary (editing) table with identical field structure. I iterate through the fields (some 50 of them) with a For Each - Next loop to update each field with the SQL statement. The updating works fine with numeric data type...
3
29754
by: Mark Sullivan | last post by:
When I trace through a csharp program I came to a situation where a certain values has an "undefined value" as shown in the debugger DbgClr. I want to check this but the following statements did not recognize this "non"-value if (type.Particle != Undefined.Value) { .... or if (type.Particle != null) { .....
2
13690
by: riceyeh | last post by:
Hi, What does <xsl:if test="not($values)"mean? What I do not understand is $values? Here, means array? And . = $value means current node is equal to the variable value? So the total meaning is "if not exists of value in array of values" ? But the result of '. = $value' is a boolean value, so '$values' should not mean "the value in values". Rice
3
7690
by: Darin | last post by:
I have a problem I just can't figure out. I have a form with a subform, and the recordsource of the subform has criteria based on some unbound fields in the parent form so that data in the parent form affects data in the subform. I've had this type of setup often, but I've run across a couple forms where this has caused an "enter parameter value" pop up for each reference to the parent control in the query when the main form is closed. ...
10
1734
by: hall.jeff | last post by:
As a relative new comer to Python, I haven't done a heck of a lot of hacking around with it. I had my first run in with Python's quirky (to me at least) tendency to assign by reference rather than by value (I'm coming from a VBA world so that's the terminology I'm using). I was surprised that these two cases behave so differently test = ,] x = test x = 5 test
5
11446
by: emsik1001 | last post by:
Hi I have a few combo boxes where the match is required. When I select a value and then delete it and go to another control then I get very user unfriendly message "invalid property value". I want to allow to go to a different controls if the value is empty and if the value is not in a drop down box I want to either display a user friendly msgbox or clear the drop down box value. Many thanks in advance
6
7527
by: tbebest | last post by:
Hi , i have a form and it has A problem: i upload my 3 image and it uploaded in definded path but in insert in db filed there are empty: Notice: Undefined offset: 0 in C:\wamp\www Notice: Undefined offset: 1 in C:\wamp\www Notice: Undefined offset: 2 in C:\wamp\www i think scope of my Array variable : newsimg has a problem. <div id="postedit" class="clearfix"> <h2 class="ico_mug">ADD NEWS</h2> <form method="post" action="<?php echo...
0
8815
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8707
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8593
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7306
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2714
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1593
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.