Google Blogger - Update page open on a tab from another tab

A question like this has been asked in SO before, and it seems impossible to capture URLs open on other tabs.

If you are writing blogs, you could see a preview button that, when clicked, opens a blog post in preview mode on a new tab, and each time you click this button, the preview page that was opened earlier is updated.

My question may not be constructive, but I was wondering how they grab the tab and refresh the page.

What things do they use? If someone gains knowledge, if you share it, it will be very helpful.

Update:

Firebugging shows that Preview is a button:

enter image description here

+4
source share
1 answer

Here is what Blogger uses for the preview link for my post:

<a href="post-preview-auth.g?postID=12345678" target="previewpost12345678">Preview</a> 

So they use the anchor tag with the custom attribute target attribute (previewpost + postID).

The first time you click on the preview link, no tab will have this custom name, so a new tab will open. If you click on it again, the new tab will not open, because a tab with this name already exists.

UPDATE:

Using a button, this is probably done in the same way using the javascript window.open method (URL, name, specification, replacement) , where the name of the target attribute or window name is indicated.

+4
source

Source: https://habr.com/ru/post/1481596/


All Articles