• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 457
  • Last Modified:

jquery, javascript new window

If I have <a href="opennewwindow.cshtml" target="_blank">quote now</a>
Most browsers will open new tab instead of new window. My goal is

1. Open new window in the middle of the webpage. and gray out the background, and hide the url location bar.

2. Don't allow open tab.

3. add javascript or jquery codes inside of <a></a> only if possible.
0
solution1368
Asked:
solution1368
  • 8
  • 6
1 Solution
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
what you want is called a modal dialog box, not to open an actual new window (most browsers have pop ups disabled anyways). jQuery has some great plug-ins to do exactly this, jModal being the most popular

http://jqueryui.com/dialog/
http://dev.iceburg.net/jquery/jqModal/

this is one of my favs
http://projects.nickstakenburg.com/lightview
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
thanks for the heads up :)
0
 
solution1368Author Commented:
Wrong. I don't want modal dialog box. I need to open different URL.
modal dialog box open something within the same webpage.

This is not solution.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
to do what you're asking (gray out the background and have the "popped up window" be the only window you can focus on, then a modal dialog approach would be best. The LightView link I gave does just this, you pass in a URL and it opens up that URL in a pop up box.

you would use either the iframe or ajax option when calling the function
0
 
solution1368Author Commented:
thank. can you show me how to do it with iframe or ajax?
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
if you go here you'll see a list of examples of the different calls you can do. for iframe, you would do:

<a href="http://docs.jquery.com" 
   class="lightview" 
   data-lightview-type="iframe" 
   data-lightview-options="width: 1000, height: '100%'">Iframe</a>

Open in new window

0
 
solution1368Author Commented:
looking for something in codes without any charges...
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
LightView is free for non-commercial sites (http://projects.nickstakenburg.com/lightview/download)

if that's not your case, then look at the other links I sent you, I'm not going to do all of the work for you
0
 
solution1368Author Commented:
can't use it. free version comes with watermark. If you don't have proper solution, it is okay. I just wait for other experts to help.
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
i am providing viable solutions, it just seems like you don't want to take the time to go look at them in depth.

did you look at jqModal? it is free and will load content via ajax (one of your requirements was to load an external URL)

http://dev.iceburg.net/jquery/jqModal/#examples
0
 
solution1368Author Commented:
Thank you for your quick responses. But I am just hoping to see a way to codes in jquery
or javascript within one line (if possible) because i will send the codes to the end user who don't have much knowledge about web programming.

Basically, your solution does not really work. Just read my original question and my three goals that I hope to achieve.


<a href="opennewwindow.cshtml" target="_blank">quote now</a>
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
you will not be able to accomplish what you're asking for with a simple line of javascript "code", you will need to use a third party plugin to make the single call easy to fire. Making a box appear and then graying out the background requires some kind of styling technique, either through CSS (the recommended way) or in-line styling. To prevent the user from interacting with anything but the main box is not simple, you'll need some separate JS code to handle that.

what I'm basically saying is there is no simple way to do this without some kind of plug-in.
0
 
solution1368Author Commented:
then we just wait for other experts's comments. I appreciate your helps
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
you're asking for something that cannot be done the way you WANT it to, it's not a matter of I don't know HOW to do it the way you want, its a matter that it just cant be done so simply.

whatever, I should have realized and took gary's advice, considering this is a duplicate question of http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Jquery/Q_28278229.html
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 8
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now