JavaScript not executing correctly

RESOLVED INVALID

Status

()

Firefox
General
RESOLVED INVALID
12 years ago
12 years ago

People

(Reporter: Kevin, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

12 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3

If you execute the javascript from the address bar, you are supposed to get a new iframe on the right, but the browser is displaying "[object Text]":

javascript:{var childNodes = document.body.childNodes;var newNodes = new Array();for (var i=0; i<childNodes.length; i++) {newNodes.push(childNodes[i].cloneNode(true));}childNodes = newNodes;document.body.innerHTML="<table width=100%><tr><td width=50%><div id=origPane style=\"height:2048px;width:800px;\"> </div></td><td width=50%><div style=\"height:2048px;width:800px;\"><iframe width=100% height=100% src=http://lovjesus.bawi.org/web_ime/black.html></iframe></div></td></tr></table>";var newElem = document.getElementById("origPane");for (var i=0; i<childNodes.length; i++) {newElem.appendChild(childNodes[i]);}}





Reproducible: Always

Steps to Reproduce:
1. visit any website e.g. http://lovjesus.bawi.org/web_ime/black.html
2. type the javascript in the address bar.

Actual Results:  
"[object Text]"

Expected Results:  
A black iframe displayed on the right-hand side of the content pane.

What I am trying to do can be very useful when the new content contains an useful information.  I used "http://lovjesus.bawi.org/" because the page did not contain any javascript (embedded javascript can further complicate the issue), so that you can isolate the problem easier.

Comment 1

12 years ago
A javascript: URL replaces the current window with the result of the script (which is the value of the last evaluated expression) unless that result is undefined. Append 'void 0' to your bookmarklet.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.