View Full Version : code to get javascript to open in a new window

08-31-2011, 12:23 AM
Hi everyone

I am a newbie with respect to programming and this is my first post

I have a small problem, probably very basic to everyone except me, and would appreciate and value your advice

I have entered below a javascript I am using on my website. This script is designed to automatically insert videos based on keywords and works perfectly except that my visitors are taken away from my website when they use it.

Can someone please tell me what code to insert, and where, in order get the script to open in a new page.

I am aware how to do this in html using target ="blank" but do not know how to do it in javascript.

Thankyou in anticipation, the code I am using is below:

<!-- BEGIN HostDomain -->
<div id="HostDomain_DivId"> </div>
<script src="http://app.HostDomain.com/script/HostDomainUtils.js">
<script language="JavaScript" type="text/javascript" src="http://app.HostDomain.com/script/widgetTy pe/carousel/ptContentflow.js" load="fancyScrollbar">
<script type="text/javascript">
/* Do not change the values given below. */
var HostDomain_Organization_Name = "MySite";
var HostDomain_Organization_ID = "xxxxxxxx";
var HostDomain_Feed_ID = "xxxxxxx";
var HostDomain_DivId = "HostDomain_DivId";
var HostDomain_AppServerPath = "http://app.HostDomain.com";
<script src="http://app.HostDomain.com/script/HostDoma in.js">
<!-- END HostDomain --></font></td>

Old Pedant
08-31-2011, 01:25 AM
No place in the code you showed us is it does it "insert a video".

Clearly, the code is inside one of the ".js" files, but we can't modify it without seeing it.

I'm pretty sure we can assume it's not in the ptContentflow.js file, but it could be in either of the others.

08-31-2011, 10:56 AM
Hi Old Pedant

Many thanks for your reply

This script pulls videos from Youtube.

I have actually used it on one of my web pages and have looked at the page source there and, by clicking on the script source shown there, have been able to access the full script which is very long and way too complex for me to understand

I personally have no objections to you looking at this and would be hapy to send you the access details provided that I would not be contravening Forum Rules by doing so. However I would not wish to edit the script in any way without the permission of the script owners.

In my ignorance I thought there might have been a way (as in html) of adding a little bit of code to get the "open in new window" action I desired but maybe this is not possible.

If there is any further way you can help that would be great, if not then many thanks for your help so far.

Old Pedant
08-31-2011, 08:29 PM
You can certainly pm me if you wish.

It's *possible* we could do this without altering their code. But only if *EVERY* person gets some kind of video. What we *might* be able to do is move all of the relevant code (and I still don't know what parts are relevant) into a popup window. But that would be a poor solution if some people do NOT get a video, as then they'd get this blank popup.