?
Solved

jquery, javascript new window

Posted on 2013-11-04
15
Medium Priority
?
449 Views
Last Modified: 2013-11-09
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
Comment
Question by:solution1368
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 6
15 Comments
 
LVL 33

Expert Comment

by:Big Monty
ID: 39622491
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
 
LVL 33

Expert Comment

by:Big Monty
ID: 39622545
thanks for the heads up :)
0
 

Author Comment

by:solution1368
ID: 39622752
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
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.

 
LVL 33

Expert Comment

by:Big Monty
ID: 39622764
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
 

Author Comment

by:solution1368
ID: 39622874
thank. can you show me how to do it with iframe or ajax?
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 39625030
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
 

Author Comment

by:solution1368
ID: 39625298
looking for something in codes without any charges...
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 39625306
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
 

Author Comment

by:solution1368
ID: 39625312
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
 
LVL 33

Expert Comment

by:Big Monty
ID: 39625337
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
 

Author Comment

by:solution1368
ID: 39625375
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
 
LVL 33

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 39625393
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
 

Author Comment

by:solution1368
ID: 39625403
then we just wait for other experts's comments. I appreciate your helps
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 39625424
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question