I have a form split apart throughout 4 tabs. One of the tabs contains photos if the user has uploaded some. Under each photo is a button to delete the photo. It performs an AJAX call to delete the photo and load in a new input[file] field that the user can use to upload another photo.
This works fine. The problem is after the user uploads the new photo, it appears as if the old photo is still there. If the user refreshes the browser, it doesn't go away. The user literally has to hold shift and then refresh (bypass cache).
The problem most likely stems from the fact that the new image gets named the same as the old one... and the browser is simply pulling from it's cache.
What do I need to do to prevent that from occurring? I've already set {cache : false} on the jQueryUI tabs. I believe it has to do with the image being cached by the browser. Is there a way to tell the browser to not cache a few images?
Try adding a parameter to the image tag source filename, such as the current timestamp to break the browser's cache? Something like:
<img src="something.jpg?234343234"/>
Related
There is this website : http://justnotepad.com/
Here we can write notes and it will store it in browser's storage so if we reload/reopen the page again it restores the previous notes.
So I want to open this website 3 times in same Browser Instance without closing it by opening and closing new tabs.
Between Closing and Opening of Tabs browser.delete_all_cookies() is executed.
But the website is still able to fetch previous notes.
The following code is working for http://temp-mail.org after each load the mail address changes. Which means the cookies are getting deleted. But can't understand why it isn't working for http://justnotepad.com/
My Full Code:
browser = webdriver.Chrome(chrome_options=chrome_options,executable_path=cpath)
for i in range(2):
browser.get('http://justnotepad.com')
t=browser.find_element_by_xpath('//div[#id="editable_text_box"]/textarea[#name="editable_text"][#id="editable_text"]')
t.send_keys(Keys.ENTER + "This is a new line")
'''
browser.get("https://temp-mail.org")
print(len(browser.window_handles))
#print(browser.get_cookie('mail'))
eid=browser.find_element_by_xpath('//input[#id="mail"]').get_attribute('value')
print(eid)
'''
print("current:",browser.current_window_handle)
browser.execute_script("window.open('', 'new_tab')")
print(len(browser.window_handles))
next_tab=browser.window_handles[len(browser.window_handles)-1]
print(next_tab)
print(browser.title)
browser.delete_all_cookies()
#browser.delete_cookie('mail')
browser.close()
print(len(browser.window_handles))
browser.switch_to_window(next_tab)
I know this is old, but like when you inject cookies and refresh the page for them to load, the same goes for deleting.
Try to refresh the page and see if that makes a difference.
driver.refresh()
time.sleep(seconds) # Wait for it to load
In this case, the information is not stored in the cookies. It is in the browser's Local Storage.
To show:
browse to http://justnotepad.com/
Open Dev Tools (F12)
Use the Application tab
Click on Local Storage
Click on justnotepad.com leaf
Write something in the notepad.
Watch the key and value twitch.
Delete the note. Watch the key and value twitch.
I need to make a website with an private image inside of <img /> tag, which mean you cannot view it any where outside that website. I need the image to not be displayed even if the user try to copy the src of the image and open it in another tab of the same browser.
Is it possible? If so, how can i achieve that?
Short answer: no. Long answer: not possible :-)
If you can get at it in any way (and you must be able to do that to get it to render in a browser), you can save it locally.
All someone would have to do is access it with a munged copy of a browser that saves all incoming data to disk.
There are ways to obfuscate the image so that the user won't be able to just copy and paste the URL, you can use the Javascript Image object to create a new image and drawImage to draw it into a canvas, however you'll still need to obtain the image data somehow, perhaps making an ajax request for the actual image on the server. However a really persistent user can inspect your javascript code and do some reverse engineering to get the image source.
A more naive user will just take an screenshot of the image and achieve the same effect.
So any attempt to try to prevent the user from copying the image is futile.
I need to be able to get a path to images that cached.
While I am wondering if there is a way to do this using SDWebImage, I could probably get away with just having the knowledge to return a path to an image stored in the cache so I can display it within a uiwebview inside an image tag.
According to this https://github.com/rs/SDWebImage/issues/25 it would seem you can simply refer to the image by it's original url and it will be correctly picked up from cache.
I have a big SVG document here, containing a map of all the quests in a certain online game. Each quest node is inside a SVG <a> element, linking to a distinct named anchor in a big HTML document that loads in another tab, containing further details about that particular quest. This works exactly as desired in desktop Safari, and I'd expect it to work just as well in any browser that supports SVG at all since I'm using only the most basic form of linking, but it fails badly on Mobile Safari (iOS 6) - which is my single most important browser target, considering that the game in question is for the iPad. It only scrolls to the correct anchor on the initial load of the HTML page; clicking a different quest in the SVG tab will cause a switch to the HTML tab, and the hash (fragment ID) in the address bar changes, but the page doesn't auto-scroll.
This appears to be a known limitation in Mobile Safari - hash-only changes in the URL apparently used to force a page reload, and that got over-fixed such that nothing gets triggered at all now. The fixes I've found online all seem to be applicable only in cases where the URL change is being generated programatically, from within the same document, rather than static links from a different document.
Further details:
I've tried doing the named anchors in both the old <a name="..."> form, and the newer <h1 id="..."> form. No difference.
I've tried adding an onhashchange handler, to force the scrolling to take place, but the handler isn't being called at all (verified by putting an alert() in it).
I could presumably fix the problem by having each quest's details in a separate HTML file, but that would severely affect usability - with all the details in a single file, you can use your browser's Find feature to search through them all at once. (Also, deploying 1006 files to my web hosting after each update would be a bit of a pain...)
Anybody have an idea for a work-around?
I have a problem uploading an image to a form field using the built in xpages fileuploader control. The form field the image is saved to is configured like explained in this blog post by Mats Knutsen: http://devxpages.blogspot.com/2011/03/display-picture-from-rich-text-field.html . I Also plan to display the image in an xpage using the template described in the blog post, like this (http://server/MyDatabase.nsf/viewunid/docunid/imageField/M2?OpenElement).
I know my fileuploader control points to the correct field in the form, since i can see the image in the document using the Lotus Notes Client after the document is created. However; the picture can not be viewed using "http://server/MyDatabase.nsf/viewunid/docunid/imageField/M2?OpenElement" at this point.
On the other hand, if I delete the field contents (the image) from the document field in the client, go back to the xpage with the fileuploader control, and uploads the image a second time, it works perfectly, and the image can be viewed using the url mentioned above.
When I access field properties after the first upload, the Data Type of my field is set to Rich Text.
The second time I upload the same image to the same field in the same document, the field properties Data Type is set to MIME Part, as it probably should have gotten the first time around as well.
Does anyone know why my file uploader control does not work the first time i upload the image, but when I edit the docuement and upload the image a second time, everything seems to be ok?
I would try to avoid uploading images into the RichText in the first place. Would it break your application if you resort to uploading the image as a regular attachment? You then can reference it using .../$File/imgfilename.jpg (using the file name used during upload - retrieved by #AttachmentNames)