I have two browser windows open. One is a website assistant, the other is the actual website that assistant is related to.
If a user clicks a link from the assistant window, is it possible to trigger the loading of that page/link to appear on the second window instead of the assistant window?
I have no code for this, simply a question before I go any further.
A perfect example is www.ikea.co.uk. Click 'ask anna' in the header, and ask her 'how much is a bed'. The links it provides will open in window #1.
How do you open the windows? With Javascript? Define a name to each frame/window and call for them on links. Something like that:
<iframe name="two"><iframe>
link
Related
Is it possible to force a pop up to open in an iframe where the action to open the pop up has taken place?
I have a VueJs Application that displays a website inside an iframe and don't want the application to open new windows. But it is also not acceptable to just block all the popups with sand boxing, as some contain critical functionality.
Thus i am looking for any way to "force" target="_blank" onto the link on the webpage.
I know that there is no standard way to do so, but would be open for any suggestion on how to alternatively solve this.
Maybe there is a way to disable the browsers ability to open new windows and hijack the calls.
Looking forward to your answers.
That capability is all or nothing, mostly. Since it's a different site in the iframe, you likely don't have access to the iframe content and so can't control the links in it.
iframe has a sandbox attribute to which you could add the allow-popups option
allow-popups: Allows popups (such as window.open(), target="_blank", or showModalDialog()). If this keyword is not used, the popup will silently fail to open.
As in:
<iframe ... sandbox="allow-popups"></iframe>
There's also:
allow-popups-to-escape-sandbox: Lets the sandboxed document open new windows without those windows inheriting the sandboxing. For example, this can safely sandbox an advertisement without forcing the same restrictions upon the page the ad links to.
allow-modals: Lets the resource open modal windows.
I am working on a client site where the client has requested that there be a button (basic a link) that links to another page like google, in case an abusive significant other busts into the room while a woman is reading about how to get assistance. The tricky part is that I am trying to figure out to link to a page that will open int he same windows, but no let you go back to the site by clicking the browser's back button, or show up in "history". I have built a lot of website and never heard of this being possible without the use of a custom browser extension or something.
My question is ..
Is there a way to do this? Possible some JS magic? Just wondering
You're looking for location.replace().
<button onclick='location.replace("https://www.google.com");'>Click to close</button>
Instead of creating a new entry in browser history, it replaces the current one.
Note: Unfortunately, it's blocked by [SO]. But just try it in your app. It does work.
Second note: If you combine this with initially opening the to be hidden page in a new tab (target="_blank") => no history.
However, the best method and advice for such cases is browsing in incognito: Ctrl+Shift+N. Once closed, it's gone, with all history in the session. Pressing Ctrl+Shift+T in a new browser window won't bring the formerly opened tabs back.
IMHO, this technique should be clearly detailed in the "Precautions" section of your client's website, also advising on having another "normal" browsing session opened in a background browser window, with a few neutral tabs open on subjects that wouldn't raise any suspicions: cooking recipes, things for children, cosmetics, etc...
I am not sure about your question.
But on click you can open Iframe
<iframe src="www.google.com" style="border:none;"></iframe>
I want to write codes in my blogger to show when I browsing link likes www.12345.blogspot.com(example) ,after loading inside ,it will auto out anothor tabs in browser to run links which set by me.
So, example is i typing link of www.12345.blogspot.com and press enter to browse and will out another tabs likes www.youtube.com ,the focus point in webpage still in first (www.12345.blogspot.com).
Any codes could write about what I describe? Sorry for my bad english
If I understand you correctly, when loading a website, you want to open a second website in a separate tab while maintaining focus on the first tab. Here's how you'd do it:
var w=window.open("https://google.ie");
if(w)w.blur();
I would, however, advise very strongly against doing this.
I have a "quizzes" website where a list of quizzes is shown and each link opens a popup for a cute little quiz:
Start quiz ยป
On a desktop, I can have the user return to the quiz list with:
<a onClick="window.close()" href="#">Return to quizzes</a>
There's a couple of problems with this approach, and I'd like something better:
If the user arrived at this page with a target="_blank" link, then the "return" link should use window.close to get them back where they started
If the user agent ignores target="_blank" like iPad/Chrome then the "return" link should do a normal hyperlink to quizzes/index.htm
If the user came into quizzes/stable-tachycardia.htm via a direct link, the "return" link should do a normal hyperlink
Is there a good solution that covers each use case?
I'd have it link to a JavaScript function which checks for the presence of window.parent. If the parent window exists, open the desired URL in the parent and close the current window. If there is no parent, just open the URL in the current window.
I am making a web application which takes the exam related programming languages, and i am opening a pop up window for test when a user click to start a test ,
but i want to restrict them to go on the main broweser window until they submit the exam(pope up window closed automatically) or they will close manualy
As far as i know its not possible with javascript. but cant you better use a box that will lay on top of the original page content like you can do with Jquery.
http://jqueryui.com/dialog/#modal-form
Removing the buttons and other forms of cancelation and only leave a post button when all answers are given.