From: Chico Che on
I have a ie window that launches a pop up window with no menus/toolbars
nothing just the page. When I run an bookmarklet on main window it works
fine but when I try running this on the popup I get an access denied error.
All the javascript is doing is getting innertxt from a textbox. It works
fine when main window is done but when popup is used it does not work. If
anybody can help would greatly appreciate it.
From: Stevo on
Chico Che wrote:
> I have a ie window that launches a pop up window with no menus/toolbars
> nothing just the page. When I run an bookmarklet on main window it works
> fine but when I try running this on the popup I get an access denied error.
> All the javascript is doing is getting innertxt from a textbox. It works
> fine when main window is done but when popup is used it does not work. If
> anybody can help would greatly appreciate it.

Looking at your code, I see that your problem is with ..... oh wait,
there is no code to look at. In that case, I'm going to take a guess at
the problem being on line 37.
From: Chico Che on
Stevo <no(a)mail.invalid> wrote in news:g3rl62$ced$01$1(a)news.t-online.com:

> Chico Che wrote:
>> I have a ie window that launches a pop up window with no
>> menus/toolbars nothing just the page. When I run an bookmarklet on
>> main window it works fine but when I try running this on the popup I
>> get an access denied error. All the javascript is doing is getting
>> innertxt from a textbox. It works fine when main window is done but
>> when popup is used it does not work. If anybody can help would
>> greatly appreciate it.
>
> Looking at your code, I see that your problem is with ..... oh wait,
> there is no code to look at. In that case, I'm going to take a guess
> at the problem being on line 37.
>

My bad here is the code:

[InternetShortcut]
URL=javascript: var d=document;var df = document.frames;var screen = "Not
Found"; var id = "@$@OBJ00002[1]";if(df.length != 0){df[0].focus();for (f=
0; f< df.length;f++){var scrvalue = df[f].document.getElementById(id);if
(scrvalue != null){screen = scrvalue.innerText;}}}else{var scrvalue =
d.getElementById(id);if (d!= null){screen = scrvalue.innerText}}alert
(screen);
Modified=307DA79EA1BBC10110
IconIndex=3
IconFile=C:\WINNT\System32\url.dll
From: Thomas 'PointedEars' Lahn on
Chico Che wrote:
> Stevo wrote:
>> Chico Che wrote:
>>> I have a ie window that launches a pop up window with no
>>> menus/toolbars nothing just the page. When I run an bookmarklet on
>>> main window it works fine but when I try running this on the popup I
>>> get an access denied error. All the javascript is doing is getting
>>> innertxt from a textbox. It works fine when main window is done but
>>> when popup is used it does not work. If anybody can help would
>>> greatly appreciate it.
>> [...]
>
> [...] var d=document;var df = document.frames;var screen = "Not
> Found"; var id = "@$@OBJ00002[1]";if(df.length != 0){df[0].focus();for (f=
> 0; f< df.length;f++){var scrvalue = df[f].document.getElementById(id);if
> (scrvalue != null){screen = scrvalue.innerText;}}}else{var scrvalue =
> d.getElementById(id);if (d!= null){screen = scrvalue.innerText}}alert
> (screen);

The code doesn't handle the case that `scrvalue' is not an object reference
(e.g. is `null) because there is no element with that ID. The assignment

screen = scrvalue.innerText;

results in a TypeError (in IE: "Object expected") then. This is what
happened when I used the bookmarklet on an arbitrary document in
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; ...; .NET CLR 1.1.4322;
..NET CLR 2.0.50727)".

Anything else is specific to the document you are viewing; you should post
the URL of the opener. However, a likely cause of the error message is that
the supposed frame's content document is accessed through a domain different
from the domain of the popup document. This would be a security precaution,
by design, and cannot be reliably worked around.

Also, `document.frames' should be `window.frames', and `screen' should be
something else (as there is a host-defined property of the Global Object
with that name already).


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(a)news.demon.co.uk>
From: dhtml on
On Jun 24, 2:29 pm, Thomas 'PointedEars' Lahn <PointedE...(a)web.de>
wrote:
> Chico Che wrote:
> > Stevo wrote:
> >> Chico Che wrote:


> Also, `document.frames' should be `window.frames', and `screen' should be
> something else (as there is a host-defined property of the Global Object
> with that name already).
>

Alternatively, the code can be wrapped in a function:-

(function(){ /* bookmarklet code here */ })();

To avoid polluting or colliding with global namespace.

Garrett

> PointedEars