I am in the process of making a bookmarklet for my website.
When clicked i need it to do either one of two things.
Retreive all images that are on the page then show them in the bookmarklet.
or
Once opened the next image that is clicked on on the page is loaded into the bookmarklet.
I think the part that i am struggling with is that i cant get the bookmarklet to interact with the page at all, it's almost as if it doesn't know the page is there if that makes sense?
P.s i am using google chrome to test this and i am loading it as a extension.
Related
I'm developing a Chrome extension which updates a tab with a URLs in LinkedIn (every some times it changes the URL). The problem is that URLs in LinkedIn don't fully load until the user is focused on that site/tab, and I need the page to load when the user is using other tabs as well.
So is there any way I can use JavaScript (either using Chrome's background script, or a content script which will execute in the required tab) to make LinkedIn think the page is in focus, so that it loads fully?
I was trying to make an application in SharePoint and wanted to make it so that if you click on a button, it redirects you to a page and when that page loads I wanted it to instantly redirect the user to another page. ( I couldn't get the button to just redirect to the page I wanted on click, so that's why I tried doing it this way. ) I did this using a jQuery / JavaScript script. I'm new to making scripts so I was just testing and I ended up making this script:
<script type="text/javascript">
$(document).ready(function(){
Redirect();
});
function Redirect(){
$(document).load("url");
}
</script>
My problem is now that whenever that page loads, it just loads a blank page. But I can't get to the edit screen because it instantly redirects me to a blank page. I tried turning off JavaScript in Google Chrome but even though I was able to load the page without redirecting, I wasn't able to get to the edit page because it's in a jQuery AJAX drop down menu which obviously also doesn't work if JavaScript is turned off.
I would appreciate any help
EDIT: When I say edit screen I mean the place where I can edit the script. To do that I have to press a button on the page, but I can't do that since the page instantly redirects to a blank page.
Use the webpart maintenance page which allows you to remove and manage web parts without visiting the page, the instructions are as below.
Lets say your page is example.com/sites/default.aspx add the query string ?contents=1 to the page it will take you to the manage web parts page you can remove the script editor web part from there.
The other way is to use SharePoint designer to remove the web part this will also help you achieve the same result.
I do not want the webpage to reload if its already open, as this causes unnecessary data to be sent to the javascript application.
If the webpage is not open, I want it to be open.
If the webpage was open but the user used teh tab to load another webpage, i want a new webpage to open,.
If the webpage is open and still on the right url, I do not want any change, I do not want it to refresh.
However I can not seem to find a way to know if the url changed.
I can use cookies if i have to but would rather not. Any suggestions?
Thanks.
I am trying to load a webpage then insert my own Javascript into it.
I have the current code here:
window.location.assign('http://http://79.170.44.75/hostdoctordemo.co.uk/downloads/vpn/index.php');
document.getElementById('address_box').value = prompt("Site Address: ");
document.getElementById('go').click();
and what I am trying to do is:
Load the webpage
Set the address box to a value
Simulate a mouse click on the search button
So it loads the webpage, then searches a value it sets itself.
The problem with my current JavaScript is that as soon as the webpage has loaded the JavaScript stops working (as I expected). I have tried using the iframe tag to load the webpage 'within the webpage' but that did not work when obtaining the id and people said iframe would also not work because of the resolution difference.
**The Question: ** How do I load a webpage and run my own JavaScript code on it? Thank you!
Matthew
You're propably looking for something like Greasemonkey.
I really can't see an easy way to do what you want.
When the browser receives a web page from a server the javascript is interpreted, and only after that, the page is presented on the screen.
So you would have to have a web page with a button or other mechanism to make a request to a web server, receive the request, save its contents locally, add your javascript code and only then "give it to the browser".
I am developing a website with some links to some pages on external websites (belonging to the same company).
The client wants to add a way to easily return to the home site, i.e. something better than just using the browser's Back button, and something better than just opening the external links in a new browser window.
Seeing as I can't control the content of the external pages, I'm guessing that I will have load those external pages into a frame somewhere along the line.
So is there a way for a link to load a local page with a frameset, with the external page loaded into one of the frames? (Then we could have a "Return Home" button in the other frame.)
Or is there a better way to accomplish this? I could stretch to a bit of JavaScript if pushed...
Thanks,
Stewart.
You'll need to display the external websites in an iframe, with a link at the top (outside of the iframe) back to your site. Note that some sites employ "iframe busters" which will get rid of your iframe.
The best option is to open in a new tab - it's how people expect the web to work.