2 Replies - 405 Views - Last Post: 06 September 2011 - 01:33 PM

#1 orderassaulted  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 06-September 11

How do I open a window from within a .js file?

Posted 06 September 2011 - 11:30 AM

How do I open a window from within a .js file?

I want to do this, below in a .js file like I would in a html file.

<a href="google.co.uk" class="thickbox"></a>
Is This A Good Question/Topic? 0
  • +

Replies To: How do I open a window from within a .js file?

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4318
  • View blog
  • Posts: 12,100
  • Joined: 18-April 07

Re: How do I open a window from within a .js file?

Posted 06 September 2011 - 11:36 AM

Using the window.open() method? This method is used for opening windows. Just be cautious because some browsers may block any additional windows being created.

:)
Was This Post Helpful? 1
  • +
  • -

#3 VolcomMky  Icon User is offline

  • D.I.C Regular

Reputation: 74
  • View blog
  • Posts: 315
  • Joined: 13-May 09

Re: How do I open a window from within a .js file?

Posted 06 September 2011 - 01:33 PM

You can try emulating a click, I used jquery and javascript to do this.

Javascript
<script>
$('#hiddenclicker').trigger('click');
</script>


HTML
<a id="hiddenclicker" href="google.co.uk" class="thickbox" ></a>

This post has been edited by VolcomMky: 06 September 2011 - 01:49 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1