Link to home
Start Free TrialLog in
Avatar of solution1368
solution1368

asked on

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.
Avatar of Big Monty
Big Monty
Flag of United States of America image

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
thanks for the heads up :)
Avatar of solution1368
solution1368

ASKER

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.
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
thank. can you show me how to do it with iframe or ajax?
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

looking for something in codes without any charges...
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
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.
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
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>
ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
then we just wait for other experts's comments. I appreciate your helps
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 https://www.experts-exchange.com/questions/28278229/jquery-html-gray-out-background.html