I have 100 links for example, in a file. The idea is to loading to a php page, it loads the links file, it reads the first line and gets the first link. Then it opens it in a new window of browser, after 5 seconds the page refreshes itself and it gets the second link from the file and opens it in a new window again.
Now, I can do the whole thing by php, But I don't know how to open the link in a new window automatically without any click. and I guess it might be possible through JS.
Thanks for help :)
window.open('http://www.someurl.com','NameOfWindow');
There are also attributes you can keep specify to have more control. See http://www.pageresource.com/jscript/jwinopen.htm
Related
I want to restrict the browser not to open a page multiple times. If a page is already opened then same page should not be opened in new tab. This is because I am using a weighing scale exe file which loads wight value to URL localhost\weight\{value}. I am getting that value in my blade addweight.blade.php and using it as input in form. So every time the exe load it calls localhost\weight\{value} and it opens a new tab. It makes user to feel annoyed by opening same page in different tab. Please help me out with this.
you can try using local storage.
Window.onload=function(){
if(localStorage.getItem('tab')===1){
window.close();
}else{
localStorage.setItem("tab",1);
}
}
Window.onbeforeunload=function(){
localStorage.setItem("tab",0);
}
I'm looking for a method so that by clicking on a link in the current window of my web page I will generate a tab within the current window instead of opening a new browser window, and that this new tab has the option of being able to close (similar to an excel file where when creating a new sheet a tab is added at the bottom but have an x to close the tab). It must be flexible to create an infinite number of tabs so that depending on what is needed, the user can have several pages open at the same time and close them when they are no longer needed. I'm not sure if I should use tabs or iframes. what should i do or use? regards
PHP is server side but you can still kind open in a new tab/window.
It mostly depends on how the user configures their browser but you could just add target="_blank" to all of your <a> tags. For instance this link:
FollowTheHrefToAnExample
Alternatively you can use javascript:
window.open(destinationURL, '_blank').focus();
During web coding, We will check the page quite often. To accelerate our speed, We will open two page, one for change, one for compare.
Is there a way to clone an page completely? I mean not the usual way that open current page's URL in an new tab. I wish that eg. if Page A open a tab via js and load data via ajax, then the clone Page B should open tabe and load data too.
If can, it will be totally amazing. Thanks.
In this case you can use Blob api of javascript
I built in a jQuery collapsible plugin into my fixed header. (You can click the button in the right upper corner to open it)
My problem is as following, when I open the page, reload or click on a link it automatically opens for a second. I would like it stops doing that and instead only opens when someone actually clicks on the button.
I don't know which part of my code to add here so I uploaded both files.
Here is the code to the php file
Here is the code to the jQuery file
I'm sorry for the inconvenience. I am new to this website and I just started building my own website but I'm willing to learn.
Regards
Try setting the container that holds the content to display:none in your css file to begin with.
Then when the button is clicked change the display value. You may not need to change the display value here as the jQuery which activates and shows it just now may work fine.
How can I determine if a page is opening in an overlay or in a browser window?
To be more exact, it's download page behavior from GitHub: if you click on the Downloads button from this page, it will open a facebox overlay. However, if you copy the address from the respective link and paste it into a new tab, it will open as a new page.
So how do you check to see where is the page opening (assuming PHP)?
Edit:
This was what I was looking for.
I think you need to do the checking on the client using JavaScript and PHP is not going to help you on this one. As far as I can tell from your post you need figure out how the page is loaded. Probably it is an iframe or such. Of that you must be able to retrieve the loaded address.
I don't know why you would want to check that, but as you can see the link has an id="download_button". And in the bundle_hithub.js file the download_button is associated with the popup event. I don't know how exactyly, it's hard to read those single-line compressed JS files.
if the page that is going to be loaded has the following script
<script type="text/javascript">
window.location = "http://page-loads";
</script>
it won't run when loaded through an ajax call (since the page will most likely be appended with an innerHTML way resulting in the script being appended in the document, but not ran)
but when opened solely in the browser window - the script will run taking the user away to the desired destination!