Solved

jquery, javascript new window

Posted on 2013-11-04
15
428 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
  • 8
  • 6
15 Comments
 
LVL 32

Expert Comment

by:Big Monty
Comment Utility
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 32

Expert Comment

by:Big Monty
Comment Utility
thanks for the heads up :)
0
 

Author Comment

by:solution1368
Comment Utility
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
 
LVL 32

Expert Comment

by:Big Monty
Comment Utility
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
Comment Utility
thank. can you show me how to do it with iframe or ajax?
0
 
LVL 32

Expert Comment

by:Big Monty
Comment Utility
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
Comment Utility
looking for something in codes without any charges...
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 32

Expert Comment

by:Big Monty
Comment Utility
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
Comment Utility
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 32

Expert Comment

by:Big Monty
Comment Utility
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
Comment Utility
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 32

Accepted Solution

by:
Big Monty earned 500 total points
Comment Utility
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
Comment Utility
then we just wait for other experts's comments. I appreciate your helps
0
 
LVL 32

Expert Comment

by:Big Monty
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now