<script>
function Bookmark() {
alert(navigator.userAgent);
if (window.sidebar) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(location.href, document.title, "");
}
else if (window.external) { // IE Favorite
window.external.AddFavorite(location.href, document.title);
}
else if (window.opera && window.print) {
alert("ASAS");
var e = document.createElement('a');
e.setAttribute('href', location.href);
e.setAttribute('title', document.title);
e.setAttribute('rel', 'sidebar');
e.click();
}
}
</script>
Bookmark
I has a script to let user click to bookmark the page. It work ok in IE, but it not work in Firefox24.0 version. It show me error window.sidebar.addPanel is not a function. Any one has idea whats go wrong for the above code. Please help!!! Brilliant thanks.
addPanel was removed from Firefox since v. 23. But you can use markup instead:
Bookmark me
Related
My JS:
function redirect(aPath) {
var app = $('#divMain').injector();
if (aPath == app.get('$location').path()) {
app.get('$state').reload();
}
else {
app.get('$location').path(aPath);
}
$('#divMain').scope().$apply();
}
These cases works fine in Chrome, but in IE when I click on same page nav link i.e the "if" condition the scope().$apply() doesn't fire. Am I missing something?
Same scenario is there in Tablet(iPad) also even in Chrome.
try
angular.element($('#divMain')).scope().$apply();
How do I open a web page automatically in full screen mode?
I am looking for a solution to open an web page automatically in full screen mode, without expecting user to users press F11 or any other browser-specifc key.
I've searched a lot, but I just could not find a solution.
Is there a script or library or browser specific API available to help me achieve this?
For Chrome via Chrome Fullscreen API
Note that for (Chrome) security reasons it cannot be called or executed automatically, there must be an interaction from the user first. (Such as button click, keydown/keypress etc.)
addEventListener("click", function() {
var
el = document.documentElement
, rfs =
el.requestFullScreen
|| el.webkitRequestFullScreen
|| el.mozRequestFullScreen
;
rfs.call(el);
});
Javascript Fullscreen API as demo'd by David Walsh that seems to be a cross browser solution
// Find the right method, call on correct element
function launchFullScreen(element) {
if(element.requestFullScreen) {
element.requestFullScreen();
} else if(element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if(element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
}
}
// Launch fullscreen for browsers that support it!
launchFullScreen(document.documentElement); // the whole page
launchFullScreen(document.getElementById("videoElement")); // any individual element
Only works in IE:
window.open ("mapage.html","","fullscreen=yes");
window.open('','_parent','');
window.close();
It's better to try to simulate a webbrowser by yourself.You don't have to stick with Chrome or IE or else thing.
If you're using Python,you can try package pyQt4 which helps you to simulate a webbrowser.
By doing this,there will not be any security reasons and you can set the webbrowser to show in full screen mode automatically.
You can go fullscreen automatically by putting this code in:
var elem = document.documentElement; if (elem.requestFullscreen) { elem.requestFullscreen() }
demo: https://codepen.io/ConfidentCoding/pen/ewLyPX
note: does not always work for security reasons. but it works for me at least. does not work when inspecting and pasting the code.
view full size page large
(function () {
var viewFullScreen = document.getElementById("view-fullscreen");
if (viewFullScreen) {
viewFullScreen.addEventListener("click", function () {
var docElm = document.documentElement;
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
}
else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
}
else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
}
}, false);
}
})();
<div class="container">
<section class="main-content">
<center><button id="view-fullscreen">view full size page large</button><center>
<script>(function () {
var viewFullScreen = document.getElementById("view-fullscreen");
if (viewFullScreen) {
viewFullScreen.addEventListener("click", function () {
var docElm = document.documentElement;
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
}
else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
}
else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
}
}, false);
}
})();</script>
</section>
</div>
for view demo clcik here demo of click to open page in fullscreen
window.onload = function() {
var el = document.documentElement,
rfs = el.requestFullScreen
|| el.webkitRequestFullScreen
|| el.mozRequestFullScreen;
rfs.call(el);
};
Actually two questions:
First One: Is there anyway to start the browser on a specific URL(instead of about:blank) (I want to have a history length of 0 when starting on that URL?)
Second One:
I believe this is related to the above question
On the page I have the following:
<script type="text/javascript">
function backAway(){
if (navigator.appName == 'Microsoft Internet Explorer'){
// under ie
i = 0;
} else {
//firefox, chrome, etc..
i = 1;
}
if (history.length>i)
{
// there appear to be items in the history property
// this seems to happen with Firefox
// If refferer exists, then do a back
if (document.refferer){
history.back();
} else {
window.close();
}
} else {
window.close();
}
return false;
}
</script>
Cancel
python selenium stuff here:
driver = webdriver.Firefox()
driver.get(urlOAuth)
declineButtons = driver.find_elements_by_id('declineButton'])
declineButtons[0].click()
It successfully finds the declineButton, but the click appears to have no effect.
The page appears to function correctly when not using selenium.
Any thoughts? Suggestions? Questions?
There is no Conecept Of Array here
Use the Statement driver.findElement(By.id("declineButton")).click() I am sure this will work.
I have been trying to get this exit pop to work. So far I can get it to work on a Mac in FF, Chrome and Safari, but struggling with IE, FF, Chrome for Windows. These are two snippets that I have tried so far:
<script language=javascript>
function thankYou(){
var win=window.open("[url.com]", "_blank", "left=20,top=20,width=500,height=500,scrollbars=1"); win.focus(); }
</script>
<body onUnload="thankYou()">
and
<SCRIPT>
function thankYou() {
var ConfirmStatus = confirm("We would love to receive your feedback on your experience of this page. Would you like to complete our short survey?");
if (ConfirmStatus == true) {
window.open("[url]", "win", "left=20,top=20,width=500,height=500,scrollbars=1");
} else {
window.close();
}
}
window.onunload=thankYou;
</SCRIPT>
Not sure how to get it functioning on Windows. Thanks in advance!
change:
<body onUnload="thankYou()">
to:
<body onBeforeUnload="thankYou()">
and....
change:
window.onunload=thankYou;
to:
window.onbeforeunload=thankYou;
I am writing a piece of Javascript that stops a timer when it is running (active == 1) and the window is closed, a link is clicked, ...
I decided to use a window.onbeforeunload function that works great on IE and FF but doesn't on Chrome.
When I close the window when having a running timer in Chrome, I do get the warning that I'm leaving the page with "false" displayed above that.
Here is the relevant code:
function SetEndTimeOnClose(lngPersonID,lngToDoID){
if(active == 1){
var answer = confirm("Wil je de tijd stoppen?");
if (answer){
try{
StopStopwatch();
SetEndTime(lngPersonID,lngToDoID);
}
catch(err){
};
return true;
}
else{
return false;
}
}
}
window.onbeforeunload = function(){
return SetEndTimeOnClose(<%=lngOpenPersonID%>,<%=lngToDoID%>);
}
This one works for me: http://jsfiddle.net/PQz5k/
According to MDN, you need to return a string that will be displayed in the confirmation dialog.