/    Sign up×
Community /Pin to ProfileBookmark

Writing to a new page

I have a simple link on a page <A HREF=”javascript:initatepage(‘filename’, 0)” target=”_self”> a link </a>

(no space in javascript)

which when clicked runs the function:

function initatepage(itemcategory, startPos) {
this.location.href = ‘itemspage.html’;
document.open();
document.write(‘<html><body>some text</body></html>’);
document.close();

}

The idea is to open a blank page (itemspage.html) and dymanically write html to it. Although the text is displayed in the browser, the URL in the address bar remains as the referrer page, which when the page is refreshed causes in Netscape (well at least in version 7.2 that I have) a
Security Error: Content at wyciwyg://76/[I]referrer page[/I] may not load or link to [I]referrer page[/I].
in the javascript console.

I’ve also tried to no avail

function initatepage(itemcategory, startPos) {
var itemWindow = Window.open(‘itemspage.html’, ‘_self’);
itemWindow.document.open();
itemWindow.document.write(‘<html><body>some text</body></html>’);
itemWindow.document.close();
}

Any Suggestions?

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @sack_it spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...