Inline javascript popup windows?

They have: 330 posts

Joined: Apr 2000

I want to create a link that launches a popup window. I want it to be something that can be copied and pasted into another website if someone else wants to link directly to that popup window.

Any suggestions?

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

If I understand your question correctly I believe you just have to make a regular javascript window.open function and type an absolute path to the page you want (other sites) to open.

like this

newWin = window.open('http://www.yourDomain.com/yourPage.html');
'
Does this help?

Shakespeare: onclick || !(onclick)

They have: 330 posts

Joined: Apr 2000

that is part of what I'm looking for. The problem I am having with this type of script is if I use it as a function and call the function directly then other sites are unable to copy and paste the shortcut from my link to their site. If I use it in the href part of a link it works, but it redirects the refering page to an ugly blank screen.

Any suggestions about how to fix this problem?

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

artsapimp wrote: if I use it as a function and call the function directly then other sites are unable to copy and paste the shortcut from my link to their site.

If they're gonna copy and paste it... why not add something like this just above it: <script type="text/javascript" src="http://Path to your script/yourscript.js"/>'
They could easily copy and paste that along with the rest they're copy and pasting.

Shakespeare: onclick || !(onclick)

They have: 330 posts

Joined: Apr 2000

Yes, that would work, but wouldn't that make it ugly for the rest of the users?

My temporary fix is to redirect the users to a page with an onLoad script that pops up the window. Other sites can then link to the page with the onLoad script and everything works.

There must be a better way to do this.

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Why would that be ugly for users? I can't imagine anyone would even notice the JavaScript is called from another domain... Unless they're as nosey as I am Smiling

a Padded Cell our articles site!

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

Don't know why that would be considered ugly. It should work fine, and it's only one line of code for them to copy.

They have: 330 posts

Joined: Apr 2000

I guess I am misunderstanding what it would look like then, because my vision of what was explained was posting the code to my js file on the page. If there is something else you are thinking of please give me more details.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.