Home › Forums › JavaScript › Resize current window or Open two windows through javascript
- This topic is empty.
-
AuthorPosts
-
October 19, 2014 at 9:16 pm #186626UttamParticipant
Hello all,
No, I am not trying to be a pain in the – whatever – to my visitors – that is the best way to lose my visitors, isn’t it?
But I have a need to do one of the following:
1) Resize my current window – window 1.
2) Open a new window – window 2.OR
1) Open a new window – content same as current window.
2) Open a new window – content as window 2.
3) Close Current window.The content in window 2 is hosted on my website so there are no security issues there.
I find I can do this on IE but not on Chrome.
Any suggestions please?
Thank you in advance.
Uttam
October 19, 2014 at 10:33 pm #186630__Participantthat is the best way to lose my visitors, isn’t it?
one of. I am curious as to the use case.
1) Resize my current window
Modern browsers don’t allow this. It’s not a bug, it’s a security feature. Frankly, they are right to prevent you from doing this (which, hopefully, will encourage you to think twice about trying to do it).
2) Open a new window
window.open
is what you’re looking for. This is still supported in modern browsers, but may be restricted by security settings and/or spam blocking software (especially if you’re trying to open more than one window, especially especially at the same time).You can always use
target=_blank
in a regular hyperlink. This is very reliable, but it means your user must actually click on the link.October 19, 2014 at 11:20 pm #186631UttamParticipantThank you for your quick response.
Use case is something like this:
1) Window 1 allows the user to enter data on a form. Most of the data that is entered on the form is available on Window 2. (Although the URL in Window 2 is on my own website, it has an embedded frame with output formally and legally generated from another website – so I cannot internally transfer data within my own website into the form.)
2) On the click of a button, Window 1 is resized to half its width while in the other half, Window 2 is opened.
What I really want is the side-by-side feature – so that I can drag and drop sections of text from Window 2 into the form on Window 1.
The second method is an alternative way.
<hr />
A different related problem is in the second method – I can open the first window but cannot open the second window. This happens only in Chrome.
Would you have any suggestions for this please?
Once again, thank you for a quick response to my first posting above.
Best.
Uttam
October 20, 2014 at 9:38 am #186672__ParticipantYou’re welcome.
I can open the first window but cannot open the second window.
As I alluded to above, this is likely due to user security settings and/or anti-spam software. It’s very likely that you will get different results not only from different browsers, but for any specific user (depending on how their os/browser is configured).
What I really want is the side-by-side feature – so that I can drag and drop sections of text from Window 2 into the form on Window 1.
Have you considered simply making 2 side-by-side
iframe
s on your page?Or just one new window, and allow the user to position it as desired?
October 20, 2014 at 4:18 pm #186690UttamParticipantI have to apologize!
One of the statements I made was not entirely accurate:
"Although the URL in Window 2 is on my own website, it has an embedded frame with output formally and legally generated from another website – so I cannot internally transfer data within my own website into the form.)"
<code></code>One of the sources is a URL on my own website.
Other sources are from other websites on which I have no control.
So, an embedded frame may not work as As Far As I Know, one cannot display another website’s entire page in an embedded frame and if discovered my site could be blacklisted. The reason why I cannot go about asking permission from each potential website is because it is the User who selects which page s/he wants to display in Window 2.
I guess I will have to think up something novel here.
The website works nicely on IE, BTW.
Thank you for trying to help me.
Best regards,
Uttam
October 20, 2014 at 4:37 pm #186692__ParticipantAs Far As I Know, one cannot display another website’s entire page in an embedded frame and if discovered my site could be blacklisted.
It is technically possible, sure. But if the other website’s terms of service do not allow you to make use of their content on your site, then be aware that opening a new window for your users is basically the same thing as loading an iframe.
Check the site’s TOS. Ask them directly if it’s not clear. It may be as simple as clearly noting which content comes from their site —who knows, they might even welcome the traffic if they’re credited.
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.