Question regarding Javascript Code

Hi Hello, i tried for like 1 and a half hour to figure out how to open a javascript src in a new window.
so this is the code: script language=‘JavaScript’ src=‘http://mylush.net/js/tp.js’> /script
what exacly do i need to add inorder to open this in a new window?

any help will be appreciated!

Hi there,

Thanks for writing in.

You can only open a link to a new window through link’s HREF. Javascript SRC will not load into a new window.

Thanks!

1 Like

I actualy managed to open the javascript in a new window with target=_blank but it opens all my links on my website in a new window, any advices? or that opening this javascript link is impossible in a new window?

Hi there,

There is no target="_blank" attribute in javascript, would you mind providing a video recording of how you’re doing that?

Or are you trying to change a link’s existing target attribute using a javascript? Details will be more helpful.

Thanks!

1 Like

i think it was with / or something like that, i will try to send a video soon.

It will be also helpful if you give us the login information and show us where to find the code that you want to add. That may be a better way to find out the exact request and see how we can be of a help.

Thank you.

1 Like

ok adding a secure note

Hi there,

I see what you mean, but the issue is from the script itself.

https://mylush.net/js/tp.js

Its code is this

document.write("<a href='http://mylush.net' title='לוח ×©× ×”'>יום ראשון, ×™\"ב שבט ×”'תשע\"×—, 28/01/2018, פרשת השבוע: יתרו</a>")

The code itself doesn’t add target="_blank", but you may add your code like this

<script language="JavaScript" src="https://mylush.net/js/tp.js">
</script>
<script type="text/javascript">
jQuery( document ).ready( function($) {  
$('a[href="http://mylush.net"]').attr('target', '_blank'); 
} );
</script>

Hope this helps.

1 Like

it helped alot! thanks! exacly what i needed!

You’re most welcome!

1 Like

The code is awsome, but for some reason when i go in my website via chrome incognito the code doesnt work ,
screenshot>> http://prntscr.com/i6vzel
any idea what causes this perhaps?

Hi,

I tried in incognito mode and it seems to work on my end.

1 Like

Realy? this is weird, because this is what i see http://prntscr.com/i7fuz7

Hi there.

The site is under construction, that is why even when I wanted to use the incognito mode I had to log in to the website, having said that the navbar code shows correctly and opens up in a separate tab even in the incognito mode.

Thank you.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.